diff --git a/src/policy/rbf.cpp b/src/policy/rbf.cpp index e25f5c7c5bdf..6cecbe11ca19 100644 --- a/src/policy/rbf.cpp +++ b/src/policy/rbf.cpp @@ -56,7 +56,7 @@ RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx) } std::optional GetEntriesForConflicts(const CTransaction& tx, - CTxMemPool& pool, + const CTxMemPool& pool, const CTxMemPool::setEntries& iters_conflicting, CTxMemPool::setEntries& all_conflicts) { @@ -131,7 +131,7 @@ std::optional EntriesAndTxidsDisjoint(const CTxMemPool::setEntries& } std::optional PaysMoreThanConflicts(const CTxMemPool::setEntries& iters_conflicting, - CFeeRate replacement_feerate, + const CFeeRate& replacement_feerate, const uint256& txid) { for (const auto& mi : iters_conflicting) { @@ -159,7 +159,7 @@ std::optional PaysMoreThanConflicts(const CTxMemPool::setEntries& i std::optional PaysForRBF(CAmount original_fees, CAmount replacement_fees, size_t replacement_vsize, - CFeeRate relay_fee, + const CFeeRate& relay_fee, const uint256& txid) { // BIP125 Rule #3: The replacement fees must be greater than or equal to fees of the diff --git a/src/policy/rbf.h b/src/policy/rbf.h index 07f68c8fd4ec..0ff7cf163918 100644 --- a/src/policy/rbf.h +++ b/src/policy/rbf.h @@ -57,7 +57,7 @@ RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx); * the start; any existing mempool entries will remain in the set. * @returns an error message if Rule #5 is broken, otherwise a std::nullopt. */ -std::optional GetEntriesForConflicts(const CTransaction& tx, CTxMemPool& pool, +std::optional GetEntriesForConflicts(const CTransaction& tx, const CTxMemPool& pool, const CTxMemPool::setEntries& iters_conflicting, CTxMemPool::setEntries& all_conflicts) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); @@ -88,7 +88,8 @@ std::optional EntriesAndTxidsDisjoint(const CTxMemPool::setEntries& * @returns error message if fees insufficient, otherwise std::nullopt. */ std::optional PaysMoreThanConflicts(const CTxMemPool::setEntries& iters_conflicting, - CFeeRate replacement_feerate, const uint256& txid); + const CFeeRate& replacement_feerate, + const uint256& txid); /** Enforce BIP125 Rule #3 "The replacement transaction pays an absolute fee of at least the sum * paid by the original transactions." Enforce BIP125 Rule #4 "The replacement transaction must also @@ -103,7 +104,7 @@ std::optional PaysMoreThanConflicts(const CTxMemPool::setEntries& i std::optional PaysForRBF(CAmount original_fees, CAmount replacement_fees, size_t replacement_vsize, - CFeeRate relay_fee, + const CFeeRate& relay_fee, const uint256& txid); #endif // BITCOIN_POLICY_RBF_H diff --git a/src/validation.h b/src/validation.h index 9fef69799be0..e7729ab55d15 100644 --- a/src/validation.h +++ b/src/validation.h @@ -219,7 +219,7 @@ struct PackageMempoolAcceptResult std::map&& results) : m_state{state}, m_tx_results(std::move(results)) {} - explicit PackageMempoolAcceptResult(PackageValidationState state, CFeeRate feerate, + explicit PackageMempoolAcceptResult(PackageValidationState state, const CFeeRate& feerate, std::map&& results) : m_state{state}, m_tx_results(std::move(results)), m_package_feerate{feerate} {} diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h index 9135e48104f9..80f9233583c5 100644 --- a/src/wallet/coinselection.h +++ b/src/wallet/coinselection.h @@ -66,7 +66,7 @@ struct COutput { /** The fee required to spend this output at the consolidation feerate. */ CAmount long_term_fee{0}; - COutput(const COutPoint& outpoint, const CTxOut& txout, int depth, int input_bytes, bool spendable, bool solvable, bool safe, int64_t time, bool from_me, const std::optional feerate = std::nullopt) + COutput(const COutPoint& outpoint, const CTxOut& txout, int depth, int input_bytes, bool spendable, bool solvable, bool safe, int64_t time, bool from_me, const std::optional& feerate = std::nullopt) : outpoint{outpoint}, txout{txout}, depth{depth}, @@ -147,8 +147,9 @@ struct CoinSelectionParams { bool m_avoid_partial_spends = false; CoinSelectionParams(FastRandomContext& rng_fast, size_t change_output_size, size_t change_spend_size, - CAmount min_change_target, CFeeRate effective_feerate, - CFeeRate long_term_feerate, CFeeRate discard_feerate, size_t tx_noinputs_size, bool avoid_partial) + CAmount min_change_target, const CFeeRate& effective_feerate, + const CFeeRate& long_term_feerate, const CFeeRate& discard_feerate, + size_t tx_noinputs_size, bool avoid_partial) : rng_fast{rng_fast}, change_output_size(change_output_size), change_spend_size(change_spend_size), diff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp index cd7fd3f4dd88..23a2d4e8f6d5 100644 --- a/src/wallet/test/coinselector_tests.cpp +++ b/src/wallet/test/coinselector_tests.cpp @@ -67,7 +67,7 @@ static void add_coin(const CAmount& nValue, int nInput, CoinSet& set, CAmount fe set.insert(coin); } -static void add_coin(CoinsResult& available_coins, CWallet& wallet, const CAmount& nValue, CFeeRate feerate = CFeeRate(0), int nAge = 6*24, bool fIsFromMe = false, int nInput =0, bool spendable = false) +static void add_coin(CoinsResult& available_coins, CWallet& wallet, const CAmount& nValue, const CFeeRate& feerate = CFeeRate(0), int nAge = 6*24, bool fIsFromMe = false, int nInput =0, bool spendable = false) { CMutableTransaction tx; tx.nLockTime = nextLockTime++; // so all transactions get different hashes diff --git a/src/wallet/test/fuzz/coinselection.cpp b/src/wallet/test/fuzz/coinselection.cpp index 3465f2f331cd..4f807d7fb891 100644 --- a/src/wallet/test/fuzz/coinselection.cpp +++ b/src/wallet/test/fuzz/coinselection.cpp @@ -14,7 +14,7 @@ namespace wallet { -static void AddCoin(const CAmount& value, int n_input, int n_input_bytes, int locktime, std::vector& coins, CFeeRate fee_rate) +static void AddCoin(const CAmount& value, int n_input, int n_input_bytes, int locktime, std::vector& coins, const CFeeRate& fee_rate) { CMutableTransaction tx; tx.vout.resize(n_input + 1);