Allows us to use
coin_selection_params.m_long_term_feerate * 3
or
3 * coin_selection_params.m_long_term_feerate
instead of
CFeeRate{coin_selection_params.m_long_term_feerate.GetFee(3000)}
inspired by #27877 (review)
Allows us to use
coin_selection_params.m_long_term_feerate * 3
or
3 * coin_selection_params.m_long_term_feerate
instead of
CFeeRate{coin_selection_params.m_long_term_feerate.GetFee(3000)}
inspired by #27877 (review)
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For detailed information about the code coverage, see the test coverage report.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | ajtowns, kevkevinpal, ismaelsadeeq, achow101 |
Stale ACK | kashifs |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
No conflicts as of last run.
70@@ -71,6 +71,8 @@ class CFeeRate
71 friend bool operator!=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK != b.nSatoshisPerK; }
72 CFeeRate& operator+=(const CFeeRate& a) { nSatoshisPerK += a.nSatoshisPerK; return *this; }
73 std::string ToString(const FeeEstimateMode& fee_estimate_mode = FeeEstimateMode::BTC_KVB) const;
74+ friend CFeeRate operator*(const CFeeRate& f, int a) { return CFeeRate(a * f.nSatoshisPerK); }
75+ friend CFeeRate operator*(int a, const CFeeRate& f) { return f * a; }
nit: To me it confused me for a moment cause I didn’t realize that f was using the operator defined on the line above, I think it would make more sense for a reader to just see the same thing above defined backwards like so
friend CFeeRate operator*(int a, const CFeeRate& f) { return CFeeRate(f.nSatoshisPerK * a); }
feel free to ignore this suggestion though
70@@ -71,6 +71,8 @@ class CFeeRate
71 friend bool operator!=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK != b.nSatoshisPerK; }
72 CFeeRate& operator+=(const CFeeRate& a) { nSatoshisPerK += a.nSatoshisPerK; return *this; }
73 std::string ToString(const FeeEstimateMode& fee_estimate_mode = FeeEstimateMode::BTC_KVB) const;
74+ friend CFeeRate operator*(const CFeeRate& f, int a) { return CFeeRate(a * f.nSatoshisPerK); }
75+ friend CFeeRate operator*(int a, const CFeeRate& f) { return CFeeRate(a * f.nSatoshisPerK); }
operator+=
and operator*
but no operator*=
or operator+
.
86@@ -87,10 +87,30 @@ BOOST_AUTO_TEST_CASE(GetFeeTest)
87 CFeeRate(MAX_MONEY, std::numeric_limits<uint32_t>::max()).GetFeePerK();