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
71
71
friend bool operator !=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK != b.nSatoshisPerK ; }
72
72
CFeeRate& operator +=(const CFeeRate& a) { nSatoshisPerK += a.nSatoshisPerK ; return *this ; }
73
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 ); }
74
76
75
77
SERIALIZE_METHODS (CFeeRate, obj) { READWRITE (obj.nSatoshisPerK ); }
76
78
};
Original file line number Diff line number Diff line change @@ -85,6 +85,12 @@ BOOST_AUTO_TEST_CASE(GetFeeTest)
85
85
BOOST_CHECK (CFeeRate (CAmount (27 ), 789 ) == CFeeRate (34 ));
86
86
// Maximum size in bytes, should not crash
87
87
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 ));
88
94
}
89
95
90
96
BOOST_AUTO_TEST_CASE (BinaryOperatorTest)
You can’t perform that action at this time.
0 commit comments