mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 01:33:20 +02:00
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).
This commit is contained in:
@@ -51,8 +51,10 @@ struct CoinsResult {
|
||||
void Shuffle(FastRandomContext& rng_fast);
|
||||
void Add(OutputType type, const COutput& out);
|
||||
|
||||
/** Sum of all available coins */
|
||||
/** Sum of all available coins raw value */
|
||||
CAmount total_amount{0};
|
||||
/** Sum of all available coins effective value (each output value minus fees required to spend it) */
|
||||
std::optional<CAmount> total_effective_amount{0};
|
||||
};
|
||||
|
||||
struct CoinFilterParams {
|
||||
|
||||
Reference in New Issue
Block a user