mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 08:03:39 +00:00
send: Amount validation stays invalid after funding or coinbase maturity #996
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml#996
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
An amount entered before the wallet has enough funds can stay invalid after the balance changes. I reproduced this on
qt6with both an ordinary incoming payment and coinbase maturity.For the ordinary payment, Send shows 2 BTC available but still rejects the existing 1 BTC draft with "Amount exceeds available balance". Review stays disabled until the amount is edited.
#990 fixes the ordinary incoming-payment case in the build I tested. The maturity refresh gap remains, and on #990 it also rejects an amount first entered after maturity. These need to be distinguished when checking the fix.
Environment
qt6ata91f4b4774f25de061fe1a7c132a91ddde117fcaand #990 at7e432cefdc77a0c473477a34b8b3138d7a0522c2.qt6at09c6de77d7f36bf7fa07c354ebeea51105c447a3, #990 at2f8b6d43f1ced340ed424ef397739b888e63098d. Their relevant wallet/recipient model code is unchanged from the tested builds.For the steps below, start the GUI with a fresh regtest datadir, RPC enabled and a fallback fee, for example
-regtest -server -fallbackfee=0.0001.climeansbitcoin-cli -regtest -datadir=/absolute/path/to/test-datadir, plus any RPC options for that node.Case 1: an incoming payment funds an existing draft
Create an empty recipient wallet and a separate funded wallet:
Select
send_draftin the GUI and open Send. Enter destinationbcrt1qdavt4j2sd7dlhqsavtnfxvzppw6k7qy97tmnu9and amount 1 BTC. Confirm that the insufficient-balance error is shown.Keep the draft open and leave its address and amount untouched. Fund it and confirm the payment:
Wait for Send's available balance to show 2 BTC. On
qt6, the old validation error remains and Review stays disabled. Editing the amount to 1.1 BTC clears it.Recorded after a ten-second wait:
Case 2: an existing draft remains invalid after coinbase maturity
Use a fresh regtest datadir for this case.
Create a wallet and mine one block to it:
Select
send_maturity, open Send, and let the initial transaction notification settle. Enter the outside address and 1 BTC. The coinbase is still immature, so the amount is correctly rejected.Leave the draft untouched and mine the next 100 blocks outside this wallet:
Core now reports 50 BTC trusted and zero immature. On
qt6, after a ten-second wait, Send still shows zero available, retains the amount error and disables Review. Editing to 1.1 BTC makes validation pass, although the available-balance label is stale.On #990, the stale balance also rejects a newly entered 1 BTC amount after maturity. I checked that separately by leaving the amount empty until step 3 had completed. As a control, changing the receiving address's label triggers a refresh; the GUI then shows 50 BTC and enables Review without changing the amount:
Expected result and remaining work
When funds become spendable, the available balance and existing recipient validation should update together, without editing the draft or triggering an unrelated wallet notification.
The invalid existing draft already occurs on
qt6. #990 adds revalidation whenbalanceChangedis emitted, which fixes case 1. The remaining problem is refreshing after maturity when the intervening blocks create no new transactions for this wallet. Using the stale cached balance also makes case 2 reject freshly entered amounts on #990.Related to #968 and #633. Regression coverage should keep an invalid draft untouched while an incoming payment confirms and while a coinbase matures, checking the balance, error and Review state together. It should also cover a newly entered amount after maturity and a reorg that reverses maturity.