mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-06 13:47:56 +02:00
Merge bitcoin/bitcoin#34888: wallet: fix amount computed as boolean in coin selection
0026b330c4wallet: fix amount computed as boolean in coin selection (furszy) Pull request description: Stumbled upon this tiny bug. This has been working by accident. The comparison is evaluated first, so `total_amount` ends up holding a boolean instead of the actual amount. It can be verified by adding the value to the returned error message and running the `wallet_create_tx.py` test. Note: I assume something like `-Wparentheses` in CI (or similar) should help us catching similar issues elsewhere. ACKs for top commit: fjahr: utACK0026b330c4achow101: ACK0026b330c4andrewtoth: utACK0026b330c4luke-jr: utACK0026b330c4Tree-SHA512: 289c1eb34e59caae0a9e6814a14e4a7ba72f26e3b26717bb3f9e60335c9c5efcebe7e5997f799752096cf91df416a82b8677a9900e5ec54b6d13921d4299be96
This commit is contained in:
@@ -939,7 +939,7 @@ util::Result<SelectionResult> AutomaticCoinSelection(const CWallet& wallet, Coin
|
||||
if (group.m_ancestors >= max_ancestors || group.m_max_cluster_count >= max_cluster_count) total_unconf_long_chain += group.GetSelectionAmount();
|
||||
}
|
||||
|
||||
if (CAmount total_amount = available_coins.GetTotalAmount() - total_discarded < value_to_select) {
|
||||
if (CAmount total_amount = available_coins.GetTotalAmount() - total_discarded; total_amount < value_to_select) {
|
||||
// Special case, too-long-mempool cluster.
|
||||
if (total_amount + total_unconf_long_chain > value_to_select) {
|
||||
return util::Error{_("Unconfirmed UTXOs are available, but spending them creates a chain of transactions that will be rejected by the mempool")};
|
||||
|
||||
Reference in New Issue
Block a user