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)
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
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.
<!--174a7506f384e20aa4161008e828411d-->
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
Sure, I updated it to use the same formula in both lines, so that only the parameters appear in either order
ACK 1553c80
Thanks both of you! @kashifs: If you open a PR against my PR or send me a patch by email, I’d be happy to add your commit with the additional tests to the PR.
Hi @murchandamus, I believe that I correctly opened a PR against this PR. Please let me know if this is the correct etiquette or if there is anything more that I should do.
Thanks @kashifs, I’ve merged your pull request into my pull request and pushed it.
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); }
Seems strange to have operator+= and operator* but no operator*= or operator+.
ACK 1757452cc55a6dacc62e4258043ee4d711fd281a ; lgtm
reACK 1757452
ACK 1757452cc55a6dacc62e4258043ee4d711fd281a
86 | @@ -87,10 +87,30 @@ BOOST_AUTO_TEST_CASE(GetFeeTest)
87 | CFeeRate(MAX_MONEY, std::numeric_limits<uint32_t>::max()).GetFeePerK();
nit: will be nice to squashed this 1757452cc55a6dacc62e4258043ee4d711fd281a to the first commit
ACK 1757452cc55a6dacc62e4258043ee4d711fd281a