diff --git a/src/wallet/spend.h b/src/wallet/spend.h index 4cf4ef78eba..71294e45d8d 100644 --- a/src/wallet/spend.h +++ b/src/wallet/spend.h @@ -58,8 +58,12 @@ struct CoinsResult { void Shuffle(FastRandomContext& rng_fast); void Add(OutputType type, const COutput& out); - CAmount GetTotalAmount() { return total_amount; } - std::optional GetEffectiveTotalAmount() { return total_effective_amount; } + CAmount GetTotalAmount() const { return total_amount; } + std::optional GetEffectiveTotalAmount() const { return total_effective_amount; } + // Returns the appropriate total based on whether fees are being subtracted from outputs + std::optional GetAppropriateTotal(bool subtract_fee_outputs) const { + return subtract_fee_outputs ? total_amount : total_effective_amount; + } private: /** Sum of all available coins raw value */