aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.h
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-11-22 11:51:33 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-12-02 12:39:15 -0300
commitc4e3b7d6a154e82cdb902fd7bcb7b725aebde5ea (patch)
treee675087c7edfe2b57d071702e51b66cd0bfd6770 /src/wallet/coinselection.h
parentcac2725fd0f5baeb741dfe079a87332784c2adc7 (diff)
downloadbitcoin-c4e3b7d6a154e82cdb902fd7bcb7b725aebde5ea.tar.xz
wallet: SelectCoins, return early if wallet's UTXOs cannot cover the target
The CoinsResult class will now count the raw total amount and the effective total amount internally (inside the 'CoinsResult::Add' and 'CoinsResult::Erase' methods). So there is no discrepancy between what we add/erase and the total values. (which is what was happening on the coinselector_test because the 'CoinsResult' object is manually created there, and we were not keeping the total amount in sync with the outputs being added/removed).
Diffstat (limited to 'src/wallet/coinselection.h')
-rw-r--r--src/wallet/coinselection.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h
index b23dd10867..b02e006435 100644
--- a/src/wallet/coinselection.h
+++ b/src/wallet/coinselection.h
@@ -110,6 +110,8 @@ public:
assert(effective_value.has_value());
return effective_value.value();
}
+
+ bool HasEffectiveValue() const { return effective_value.has_value(); }
};
/** Parameters for one iteration of Coin Selection. */