diff options
author | Andrew Chow <github@achow101.com> | 2023-04-11 13:58:00 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-04-11 14:05:55 -0400 |
commit | 27dcc07c08a77eba53ccc91e5521ff674f1bd198 (patch) | |
tree | 67ac8b74030b246257cee31ec9b57befa0ce2b99 /src/validationinterface.cpp | |
parent | c17d4d3b6b5b28a404cf43ce351d5a482d56cc65 (diff) | |
parent | 68eed5df8656bed1be6526b014e58d3123102b03 (diff) |
Merge bitcoin/bitcoin#26699: wallet, gui: bugfix, getAvailableBalance skips selected coins
68eed5df8656bed1be6526b014e58d3123102b03 test,gui: add coverage for PSBT creation on legacy watch-only wallets (furszy)
306aab5bb471904faed325d9f3b38b7e891c7bbb test,gui: decouple widgets and model into a MiniGui struct (furszy)
2f76ac0383904123676f1b4eeba0f772a4c5cb5d test,gui: decouple chain and wallet initialization from test case (furszy)
cd98b717398f7b13ace91ea9efac9ce1e60b4d62 gui: 'getAvailableBalance', include watch only balance (furszy)
74eac3a82fc948467d5a15a5af420b36ce8eb04a test: add coverage for 'useAvailableBalance' functionality (furszy)
dc1cc1c35995dc09085b3d9270c445b7923fdb51 gui: bugfix, getAvailableBalance skips selected coins (furszy)
Pull request description:
Fixes https://github.com/bitcoin-core/gui/issues/688 and https://github.com/bitcoin/bitcoin/issues/26687.
First Issue Description (https://github.com/bitcoin-core/gui/issues/688):
The previous behavior for `getAvailableBalance`, when the coin control had selected coins, was to return the sum of them. Instead, we are currently returning the wallet's available total balance minus the selected coins total amount.
Reason:
Missed to update the `GetAvailableBalance` function to include the coin control selected coins on #25685.
Context:
Since #25685 we skip the selected coins inside `AvailableCoins`, the reason is that there is no need to waste resources walking through the entire wallet's txes map just to get coins that could have gotten by just doing a simple `mapWallet.find`).
Places Where This Generates Issues (only when the user manually select coins via coin control):
1) The GUI balance check prior the transaction creation process.
2) The GUI "useAvailableBalance" functionality.
Note 1:
As the GUI uses a balance cache since https://github.com/bitcoin-core/gui/pull/598, this issue does not affect the regular spending process. Only arises when the user manually select coins.
Note 2:
Added test coverage for the `useAvailableBalance` functionality.
----------------------------------
Second Issue Description (https://github.com/bitcoin/bitcoin/issues/26687):
As we are using a cached balance on `WalletModel::getAvailableBalance`,
the function needs to include the watch-only available balance for wallets
with private keys disabled.
ACKs for top commit:
Sjors:
tACK 68eed5df8656bed1be6526b014e58d3123102b03
achow101:
ACK 68eed5df8656bed1be6526b014e58d3123102b03
theStack:
ACK 68eed5df8656bed1be6526b014e58d3123102b03
Tree-SHA512: 674f3e050024dabda2ff4a04b9ed3750cf54a040527204c920e1e38bd3d7f5fd4d096e4fd08a0fea84ee6abb5070f022b5c0d450c58fd30202ef05ebfd7af6d3
Diffstat (limited to 'src/validationinterface.cpp')
0 files changed, 0 insertions, 0 deletions