diff options
author | glozow <gloriajzhao@gmail.com> | 2021-09-08 09:44:39 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2021-09-10 09:38:01 +0100 |
commit | c78eb8651b0949fefcafb22940512f4ef98d3358 (patch) | |
tree | cfc6c3ad0f4a7e1e5672a3d13972208cf4edf947 /src/policy | |
parent | 60881158c8010e436e3c107a2d62ffb7aa23220c (diff) |
[policy/refactor] pass in relay fee instead of using global
Diffstat (limited to 'src/policy')
-rw-r--r-- | src/policy/rbf.cpp | 5 | ||||
-rw-r--r-- | src/policy/rbf.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/policy/rbf.cpp b/src/policy/rbf.cpp index 15527afb8a..cefc25a225 100644 --- a/src/policy/rbf.cpp +++ b/src/policy/rbf.cpp @@ -150,6 +150,7 @@ std::optional<std::string> PaysMoreThanConflicts(const CTxMemPool::setEntries& i std::optional<std::string> PaysForRBF(CAmount original_fees, CAmount replacement_fees, size_t replacement_vsize, + CFeeRate relay_fee, const uint256& txid) { // The replacement must pay greater fees than the transactions it @@ -163,11 +164,11 @@ std::optional<std::string> PaysForRBF(CAmount original_fees, // Finally in addition to paying more fees than the conflicts the // new transaction must pay for its own bandwidth. CAmount additional_fees = replacement_fees - original_fees; - if (additional_fees < ::incrementalRelayFee.GetFee(replacement_vsize)) { + if (additional_fees < relay_fee.GetFee(replacement_vsize)) { return strprintf("rejecting replacement %s, not enough additional fees to relay; %s < %s", txid.ToString(), FormatMoney(additional_fees), - FormatMoney(::incrementalRelayFee.GetFee(replacement_vsize))); + FormatMoney(relay_fee.GetFee(replacement_vsize))); } return std::nullopt; } diff --git a/src/policy/rbf.h b/src/policy/rbf.h index 56468a09b2..e8cfb2e643 100644 --- a/src/policy/rbf.h +++ b/src/policy/rbf.h @@ -84,12 +84,14 @@ std::optional<std::string> PaysMoreThanConflicts(const CTxMemPool::setEntries& i * @param[in] original_fees Total modified fees of original transaction(s). * @param[in] replacement_fees Total modified fees of replacement transaction(s). * @param[in] replacement_vsize Total virtual size of replacement transaction(s). + * @param[in] relay_fee The node's minimum feerate for transaction relay. * @param[in] txid Transaction ID, included in the error message if violation occurs. * @returns error string if fees are insufficient, otherwise std::nullopt. */ std::optional<std::string> PaysForRBF(CAmount original_fees, CAmount replacement_fees, size_t replacement_vsize, + CFeeRate relay_fee, const uint256& txid); #endif // BITCOIN_POLICY_RBF_H |