Send: Leaving an untouched amount field can cancel Use maximum #1000

Open
opened 2026-10-12 05:03:55 +00:00 by jarolrod · 1 comment
jarolrod commented 2026-10-12 05:03:55 +00:00 (Migrated from github.com)

I reproduced Use maximum reverting to an older amount after the wallet's balance changed. Clicking away from the amount field was enough; I didn't edit it.

To reproduce:

  1. Use the regtest setup from qml_test_psbt.build_fixtures. Select psbt-source, which initially has 50 BTC spendable. psbt-review-only is funded separately.
  2. Open Send, enter a destination and select Use maximum. Wait for the fee preview.
  3. Click Amount and leave it focused without typing.
  4. Send 0.5 BTC to a new address in psbt-source from psbt-review-only, then mine one block to the funding wallet. In this fixture, another 50 BTC reward also matures in psbt-source.
  5. Wait for the balance and fee preview to update.
  6. Click Note to self without changing the amount.

The balance reached 100.5 BTC, but the focused field retained 49.99999890. The refreshed draft used 100.49999755. Clicking Note wrote the old field value back into the draft and disabled maximum mode. Selecting Use maximum again recovered.

An untouched field should not overwrite the refreshed amount or turn send-all into a fixed payment when it loses focus. We should also keep deliberate amount edits working normally.

Tested on qt6 at 09c6de77d7f36bf7fa07c354ebeea51105c447a3, macOS arm64, Qt 6.9.0. I used the unchanged application with native mouse clicks for focus and blur, and checked the balances through RPC. No transaction was broadcast by this reproduction.

This differs from #996: the refreshed draft is valid here, but stale field text overwrites it.

I reproduced Use maximum reverting to an older amount after the wallet's balance changed. Clicking away from the amount field was enough; I didn't edit it. To reproduce: 1. Use the regtest setup from [`qml_test_psbt.build_fixtures`](https://github.com/bitcoin-core/gui-qml/blob/09c6de77d7f36bf7fa07c354ebeea51105c447a3/test/functional/qml_test_psbt.py#L131). Select `psbt-source`, which initially has 50 BTC spendable. `psbt-review-only` is funded separately. 2. Open Send, enter a destination and select Use maximum. Wait for the fee preview. 3. Click Amount and leave it focused without typing. 4. Send 0.5 BTC to a new address in `psbt-source` from `psbt-review-only`, then mine one block to the funding wallet. In this fixture, another 50 BTC reward also matures in `psbt-source`. 5. Wait for the balance and fee preview to update. 6. Click Note to self without changing the amount. The balance reached 100.5 BTC, but the focused field retained `49.99999890`. The refreshed draft used `100.49999755`. Clicking Note wrote the old field value back into the draft and disabled maximum mode. Selecting Use maximum again recovered. An untouched field should not overwrite the refreshed amount or turn send-all into a fixed payment when it loses focus. We should also keep deliberate amount edits working normally. Tested on `qt6` at `09c6de77d7f36bf7fa07c354ebeea51105c447a3`, macOS arm64, Qt 6.9.0. I used the unchanged application with native mouse clicks for focus and blur, and checked the balances through RPC. No transaction was broadcast by this reproduction. This differs from #996: the refreshed draft is valid here, but stale field text overwrites it.
jarolrod commented 2026-11-05 18:05:07 +00:00 (Migrated from github.com)

There is a complementary amount-edit case to cover here: a deliberate replacement can be discarded while Use maximum remains active.

On qt6 at d567e3eb2497, macOS / Qt 6.9.0:

  1. Use a regtest wallet with several spendable coins. Open Send, leave the address empty, and select Use maximum. In my fixture the amount was 53.76000000 BTC.
  2. Lock a 0.01 BTC coin through RPC using lockunspent. The available balance becomes 53.75 BTC, but the amount field still shows 53.76 BTC.
  3. Replace the entire amount with 0.01234567.
  4. The field changes to 53.75000000 and still says Sending maximum available. The replacement amount has been discarded.

Entering a destination afterwards keeps maximum mode active. Review still presents Use all available funds? and then shows the full payment, less the fee. No transaction was broadcast. Replacing the amount a second time works, and entering a destination before the same sequence preserves the edit correctly.

A coinbase maturing while the displayed maximum remains stale produced the same result. The balance-refresh gaps are related to #995 and #996, but the edit handling is a separate part of the problem.

In the GUI wallet model, scheduleFeeEstimates() refills the maximum from the current available balance when there is no destination. That refill runs under m_updating_maximum, before the amount-change handler can clear maximum mode for the user's edit. Core supplies the updated balance; the GUI model overwrites the edit and retains maximum mode.

A genuine amount edit should leave maximum mode before an automatic refill can replace it. Together with the original report, this needs both behaviors preserved: an untouched field must not cancel maximum mode, and a deliberate edit must cancel it and retain the entered amount.

The reproduction replaced the whole field through the test bridge in the native Cocoa GUI, emitting the edit signals. It did not establish the behavior of typing individual digits through the keyboard.

There is a complementary amount-edit case to cover here: a deliberate replacement can be discarded while **Use maximum** remains active. On `qt6` at `d567e3eb2497`, macOS / Qt 6.9.0: 1. Use a regtest wallet with several spendable coins. Open Send, leave the address empty, and select **Use maximum**. In my fixture the amount was `53.76000000` BTC. 2. Lock a 0.01 BTC coin through RPC using `lockunspent`. The available balance becomes 53.75 BTC, but the amount field still shows 53.76 BTC. 3. Replace the entire amount with `0.01234567`. 4. The field changes to `53.75000000` and still says **Sending maximum available**. The replacement amount has been discarded. Entering a destination afterwards keeps maximum mode active. Review still presents **Use all available funds?** and then shows the full payment, less the fee. No transaction was broadcast. Replacing the amount a second time works, and entering a destination before the same sequence preserves the edit correctly. A coinbase maturing while the displayed maximum remains stale produced the same result. The balance-refresh gaps are related to #995 and #996, but the edit handling is a separate part of the problem. In the GUI wallet model, `scheduleFeeEstimates()` refills the maximum from the current available balance when there is no destination. That refill runs under `m_updating_maximum`, before the amount-change handler can clear maximum mode for the user's edit. Core supplies the updated balance; the GUI model overwrites the edit and retains maximum mode. A genuine amount edit should leave maximum mode before an automatic refill can replace it. Together with the original report, this needs both behaviors preserved: an untouched field must not cancel maximum mode, and a deliberate edit must cancel it and retain the entered amount. The reproduction replaced the whole field through the test bridge in the native Cocoa GUI, emitting the edit signals. It did not establish the behavior of typing individual digits through the keyboard.
Sign in to join this conversation.
No description provided.