Send: importing a payment request for the same amount leaves Use maximum active #1121

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

After Use maximum, importing a payment request whose amount equals the amount already in the field leaves the recipient in maximum mode. The request's amount is then treated as "everything in the wallet": the fee is taken out of it, and it follows later fee and balance changes.

To reproduce at eed1f426fcb6:

  1. Use a wallet with exactly 2 BTC spendable. On a blank Send form, set a custom fee of 20 sat/vB.
  2. Click Use maximum before entering an address. The amount shows 2.00000000 with Sending maximum available under it.
  3. Open the Send options menu, choose Open payment request, enter bitcoin:<regtest address outside this wallet>?amount=2 and click Apply.
  4. The address is filled in and the amount changes to 1.99997800, still marked Sending maximum available. No message is shown.
  5. With the draft open, receive another 0.5 BTC and confirm it. The amount becomes 2.49996460.
  6. Click Review Transaction and confirm the Use all available funds? warning.

Review shows 2.49996460 BTC to the recipient, a 0.00003540 BTC fee and Ready to send, for a request that asked for 2 BTC. Changing the fee from 20 to 10 sat/vB also moves the amount. I stopped at Review and sent nothing.

File → Open URI… and the address field's Use payment request clipboard action behave the same. The clipboard route shows no Confirm paste? prompt, because the amounts match and the form has no address or label for the request to conflict with.

Controls:

  • Same request on a clean form, without Use maximum: the amount stays 2.00000000 and Review is disabled with Amount plus fee exceeds available balance. After the 0.5 BTC arrives it reviews as 2.00000000 BTC plus a 0.00004160 BTC fee, with no all-funds warning.
  • A request for a different amount (amount=1) after Use maximum: maximum mode is cleared and 1.00000000 is kept across a fee change.

The import assigns the amount (SendCreate.qml#L624-L626), and maximum mode is cleared only by the amount's change signal (walletqmlmodel.cpp#L810-L813). Assigning an equal value emits no signal (bitcoinamount.cpp#L84), so the mode survives. Clearing maximum mode explicitly whenever an imported request carries an amount would cover it.

This is narrow and visible. The requested amount has to equal the prefilled maximum to the satoshi, and the changed amount is shown in the field, the warning and Review. Related to #1000 and #1048, but it needs neither a focus change nor a leftover confirmation.

Tested on macOS / Qt 6.9, isolated regtest, offscreen. The request text and the custom fee rate were set into their fields directly, the clipboard text was set through the test bridge, and File → Open URI… was triggered through its menu action; the other steps were clicks through the test bridge. The same amounts were recorded in a native window at d567e3eb2497 in October, pasting the request into the address field.

After **Use maximum**, importing a payment request whose amount equals the amount already in the field leaves the recipient in maximum mode. The request's amount is then treated as "everything in the wallet": the fee is taken out of it, and it follows later fee and balance changes. To reproduce at `eed1f426fcb6`: 1. Use a wallet with exactly 2 BTC spendable. On a blank Send form, set a custom fee of 20 sat/vB. 2. Click **Use maximum** before entering an address. The amount shows `2.00000000` with **Sending maximum available** under it. 3. Open the Send options menu, choose **Open payment request**, enter `bitcoin:<regtest address outside this wallet>?amount=2` and click **Apply**. 4. The address is filled in and the amount changes to `1.99997800`, still marked **Sending maximum available**. No message is shown. 5. With the draft open, receive another 0.5 BTC and confirm it. The amount becomes `2.49996460`. 6. Click **Review Transaction** and confirm the **Use all available funds?** warning. Review shows 2.49996460 BTC to the recipient, a 0.00003540 BTC fee and **Ready to send**, for a request that asked for 2 BTC. Changing the fee from 20 to 10 sat/vB also moves the amount. I stopped at Review and sent nothing. **File → Open URI…** and the address field's **Use payment request** clipboard action behave the same. The clipboard route shows no **Confirm paste?** prompt, because the amounts match and the form has no address or label for the request to conflict with. Controls: - **Same request on a clean form, without Use maximum:** the amount stays 2.00000000 and Review is disabled with `Amount plus fee exceeds available balance`. After the 0.5 BTC arrives it reviews as 2.00000000 BTC plus a 0.00004160 BTC fee, with no all-funds warning. - **A request for a different amount (`amount=1`) after Use maximum:** maximum mode is cleared and 1.00000000 is kept across a fee change. The import assigns the amount ([SendCreate.qml#L624-L626](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/pages/wallet/SendCreate.qml#L624-L626)), and maximum mode is cleared only by the amount's change signal ([walletqmlmodel.cpp#L810-L813](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/models/walletqmlmodel.cpp#L810-L813)). Assigning an equal value emits no signal ([bitcoinamount.cpp#L84](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/bitcoinamount.cpp#L84)), so the mode survives. Clearing maximum mode explicitly whenever an imported request carries an amount would cover it. This is narrow and visible. The requested amount has to equal the prefilled maximum to the satoshi, and the changed amount is shown in the field, the warning and Review. Related to #1000 and #1048, but it needs neither a focus change nor a leftover confirmation. Tested on macOS / Qt 6.9, isolated regtest, offscreen. The request text and the custom fee rate were set into their fields directly, the clipboard text was set through the test bridge, and **File → Open URI…** was triggered through its menu action; the other steps were clicks through the test bridge. The same amounts were recorded in a native window at `d567e3eb2497` in October, pasting the request into the address field.
Sign in to join this conversation.
No description provided.