mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-02 09:15:04 +02:00
wallet: fix, make 'total_effective_amount' optional actually optional
this is not needed for the remaining commits but good to fix and came up in #25269 review. Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
This commit is contained in:
@@ -223,7 +223,7 @@ void CoinsResult::Erase(const std::unordered_set<COutPoint, SaltedOutpointHasher
|
|||||||
|
|
||||||
// update cached amounts
|
// update cached amounts
|
||||||
total_amount -= coin.txout.nValue;
|
total_amount -= coin.txout.nValue;
|
||||||
if (coin.HasEffectiveValue()) total_effective_amount = *total_effective_amount - coin.GetEffectiveValue();
|
if (coin.HasEffectiveValue() && total_effective_amount.has_value()) total_effective_amount = *total_effective_amount - coin.GetEffectiveValue();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
vec.erase(remove_it, vec.end());
|
vec.erase(remove_it, vec.end());
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ struct CoinsResult {
|
|||||||
void Add(OutputType type, const COutput& out);
|
void Add(OutputType type, const COutput& out);
|
||||||
|
|
||||||
CAmount GetTotalAmount() { return total_amount; }
|
CAmount GetTotalAmount() { return total_amount; }
|
||||||
std::optional<CAmount> GetEffectiveTotalAmount() {return total_effective_amount; }
|
std::optional<CAmount> GetEffectiveTotalAmount() { return total_effective_amount; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Sum of all available coins raw value */
|
/** Sum of all available coins raw value */
|
||||||
CAmount total_amount{0};
|
CAmount total_amount{0};
|
||||||
/** Sum of all available coins effective value (each output value minus fees required to spend it) */
|
/** Sum of all available coins effective value (each output value minus fees required to spend it) */
|
||||||
std::optional<CAmount> total_effective_amount{0};
|
std::optional<CAmount> total_effective_amount;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CoinFilterParams {
|
struct CoinFilterParams {
|
||||||
|
|||||||
Reference in New Issue
Block a user