Skip to content

Commit 130d190

Browse files
committed
Disallow implicit conversion for CFeeRate constructor
1 parent 36fceda commit 130d190

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/policy/feerate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CFeeRate
2525
/** Fee rate of 0 satoshis per kB */
2626
CFeeRate() : nSatoshisPerK(0) { }
2727
template<typename I>
28-
CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) {
28+
explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) {
2929
// We've previously had bugs creep in from silent double->int conversion...
3030
static_assert(std::is_integral<I>::value, "CFeeRate should be used without floats");
3131
}

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2625,7 +2625,7 @@ static UniValue settxfee(const JSONRPCRequest& request)
26252625

26262626
CAmount nAmount = AmountFromValue(request.params[0]);
26272627
CFeeRate tx_fee_rate(nAmount, 1000);
2628-
if (tx_fee_rate == 0) {
2628+
if (tx_fee_rate == CFeeRate(0)) {
26292629
// automatic selection
26302630
} else if (tx_fee_rate < ::minRelayTxFee) {
26312631
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("txfee cannot be less than min relay tx fee (%s)", ::minRelayTxFee.ToString()));

0 commit comments

Comments
 (0)