File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ class CFeeRate
7171 friend bool operator !=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK != b.nSatoshisPerK ; }
7272 CFeeRate& operator +=(const CFeeRate& a) { nSatoshisPerK += a.nSatoshisPerK ; return *this ; }
7373 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 ); }
7476
7577 SERIALIZE_METHODS (CFeeRate, obj) { READWRITE (obj.nSatoshisPerK ); }
7678};
Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ BOOST_AUTO_TEST_CASE(GetFeeTest)
8585 BOOST_CHECK (CFeeRate (CAmount (27 ), 789 ) == CFeeRate (34 ));
8686 // Maximum size in bytes, should not crash
8787 CFeeRate (MAX_MONEY, std::numeric_limits<uint32_t >::max ()).GetFeePerK ();
88+
89+ // check multiplication operator
90+ feeRate = CFeeRate (1000 );
91+ BOOST_CHECK (0 * feeRate == CFeeRate (0 ));
92+ BOOST_CHECK (3 * feeRate == CFeeRate (3000 ));
93+ BOOST_CHECK (-3 * feeRate == CFeeRate (-3000 ));
8894}
8995
9096BOOST_AUTO_TEST_CASE (BinaryOperatorTest)
You can’t perform that action at this time.
0 commit comments