diff options
author | Andrew Chow <achow101-github@achow101.com> | 2020-08-31 15:56:30 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-09-29 14:25:56 -0400 |
commit | 99b399aba5d27476b61b4865cc39553d03965d57 (patch) | |
tree | 6a8c2425180d7dc6c136476197b691029f9e82ae /src/wallet/coinselection.h | |
parent | 6148a8acda5e594bb9b3b2d989056f9e03ddbdbd (diff) |
Move fee setting of OutputGroup to Insert
OutputGroup will handle the fee and effective value computations
inside of Insert. It now needs to take the effective feerate and long
term feerates as arguments to its constructor.
Diffstat (limited to 'src/wallet/coinselection.h')
-rw-r--r-- | src/wallet/coinselection.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h index 1a0373eba1..721f1a22eb 100644 --- a/src/wallet/coinselection.h +++ b/src/wallet/coinselection.h @@ -6,11 +6,10 @@ #define BITCOIN_WALLET_COINSELECTION_H #include <amount.h> +#include <policy/feerate.h> #include <primitives/transaction.h> #include <random.h> -class CFeeRate; - //! target minimum change amount static constexpr CAmount MIN_CHANGE{COIN / 100}; //! final minimum change amount after paying for fees @@ -78,15 +77,20 @@ struct OutputGroup size_t m_descendants{0}; CAmount effective_value{0}; CAmount fee{0}; + CFeeRate m_effective_feerate{0}; CAmount long_term_fee{0}; + CFeeRate m_long_term_feerate{0}; OutputGroup() {} + OutputGroup(const CFeeRate& effective_feerate, const CFeeRate& long_term_feerate) : + m_effective_feerate(effective_feerate), + m_long_term_feerate(long_term_feerate) + {} + void Insert(const CInputCoin& output, int depth, bool from_me, size_t ancestors, size_t descendants); std::vector<CInputCoin>::iterator Discard(const CInputCoin& output); bool EligibleForSpending(const CoinEligibilityFilter& eligibility_filter) const; - //! Update the OutputGroup's fee, long_term_fee, and effective_value based on the given feerates - void SetFees(const CFeeRate effective_feerate, const CFeeRate long_term_feerate); OutputGroup GetPositiveOnlyGroup(); }; |