Receive reserves an address when its tab is shown: Addresses lists it unmarked, the next request replaces a label typed there, and Set password does not drop it #1129

Open
opened 2026-11-13 15:16:55 +00:00 by jarolrod · 0 comments
jarolrod commented 2026-11-13 15:16:55 +00:00 (Migrated from github.com)

Showing the Receive tab reserves one address for the next payment request without printing it. That address is listed in Wallet settings → Addresses like any other unused address, a label typed on it there is replaced by the next request's Note to self, and it survives Set password, so the first request after a password is set uses an address from the seed Core has just retired.

To reproduce:

  1. In a wallet that has not used Receive, click the Receive tab. No address is shown.
  2. More → View addresses. One row is listed, with "Add label..." and, in its details, Create payment request. Nothing marks it as held. Type the label Bob deposit on it.
  3. Back on Receive: amount 1, Note to self Carol invoice 17, Create payment request.

The request is on the address from step 2, and Core's label for it is now Carol invoice 17. Receive showed neither the address nor the existing label before saving.

Case Result
Request created after Receive was shown on the listed address, 8 of 8
Label typed in Addresses, request with a note / without label replaced, 3 of 3 / kept, 2 of 2
The address is paid before the request is created request on a different address, 3 of 3
Receive shown, then Set password, then a request on the address reserved before the password, 3 of 3
Same with encryptwallet in the console / with a restart before the request 3 of 3 / 3 of 3
Receive never shown before Set password first request from the new seed, 3 of 3

If the listed address is given to someone and a request is created before that person pays, two payers share it: a 0.1 BTC payment turned the 1 BTC request into "Payment received" with no QR, and after the second payer Core had 1.1 BTC and two transactions on the address. That status rule is in my comment on #1058; what is new is how two people come to hold the address.

After the password, listdescriptors has the 8 old descriptors inactive and 8 new ones active, and the first request is at m/86h/1h/0h/0/0 of the old fingerprint. Nothing is lost, but a wallet file copied before the password can also spend a payment to that address: a restored pre-password backup owned it, and not the second request's address. So my steps on #709 hold only if Receive was not shown first; I did not re-run them the other way.

The reservation is made, or restored from settings, whenever Receive becomes visible; the next request is bound to it; and a non-empty note is written over the address-book label:

github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/models/walletqmlmodel.cpp (L1218-L1255)

github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/models/walletqmlmodel.cpp (L1272-L1289)

github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/models/walletqmlmodel.cpp (L1398-L1406)

Core alone never returns an address twice, and its first getnewaddress after encryptwallet is from the new seed. Bitcoin-Qt, by its source, asks for the address at the click. Since #958 was closed nothing displays the reserved address, so could it be requested at Create payment request instead? Related: #1085, #972, #971, #1041, #914, #931.

Reproduced on qt6 at 2bd5a61e8304, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native; the counts include offscreen runs at eed1f426fcb6. Clicks and field text went through the test bridge, not by hand, and the label was committed through it in place of Return. I did not copy the address from Addresses; by the source its text is a button that copies it. Payments, and all wallets but one, came over RPC. The spend from the pre-password copy was not executed. Bech32m only.

Showing the **Receive** tab reserves one address for the next payment request without printing it. That address is listed in **Wallet settings → Addresses** like any other unused address, a label typed on it there is replaced by the next request's Note to self, and it survives **Set password**, so the first request after a password is set uses an address from the seed Core has just retired. To reproduce: 1. In a wallet that has not used Receive, click the **Receive** tab. No address is shown. 2. **More → View addresses**. One row is listed, with "Add label..." and, in its details, **Create payment request**. Nothing marks it as held. Type the label `Bob deposit` on it. 3. Back on **Receive**: amount 1, Note to self `Carol invoice 17`, **Create payment request**. The request is on the address from step 2, and Core's label for it is now `Carol invoice 17`. Receive showed neither the address nor the existing label before saving. | Case | Result | |---|---| | Request created after Receive was shown | on the listed address, 8 of 8 | | Label typed in Addresses, request with a note / without | label replaced, 3 of 3 / kept, 2 of 2 | | The address is paid before the request is created | request on a different address, 3 of 3 | | Receive shown, then **Set password**, then a request | on the address reserved before the password, 3 of 3 | | Same with `encryptwallet` in the console / with a restart before the request | 3 of 3 / 3 of 3 | | Receive never shown before **Set password** | first request from the new seed, 3 of 3 | If the listed address is given to someone and a request is created before that person pays, two payers share it: a 0.1 BTC payment turned the 1 BTC request into "Payment received" with no QR, and after the second payer Core had 1.1 BTC and two transactions on the address. That status rule is in my comment on #1058; what is new is how two people come to hold the address. After the password, `listdescriptors` has the 8 old descriptors inactive and 8 new ones active, and the first request is at `m/86h/1h/0h/0/0` of the old fingerprint. Nothing is lost, but a wallet file copied before the password can also spend a payment to that address: a restored pre-password backup owned it, and not the second request's address. So my steps on #709 hold only if Receive was not shown first; I did not re-run them the other way. The reservation is made, or restored from settings, whenever Receive becomes visible; the next request is bound to it; and a non-empty note is written over the address-book label: https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/models/walletqmlmodel.cpp#L1218-L1255 https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/models/walletqmlmodel.cpp#L1272-L1289 https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/models/walletqmlmodel.cpp#L1398-L1406 Core alone never returns an address twice, and its first `getnewaddress` after `encryptwallet` is from the new seed. Bitcoin-Qt, by its source, asks for the address at the click. Since #958 was closed nothing displays the reserved address, so could it be requested at **Create payment request** instead? Related: #1085, #972, #971, #1041, #914, #931. Reproduced on `qt6` at `2bd5a61e8304`, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native; the counts include offscreen runs at `eed1f426fcb6`. Clicks and field text went through the test bridge, not by hand, and the label was committed through it in place of Return. I did not copy the address from Addresses; by the source its text is a button that copies it. Payments, and all wallets but one, came over RPC. The spend from the pre-password copy was not executed. Bech32m only.
Sign in to join this conversation.
No description provided.