From 130d190e709fb14755e4cc85f71ba40b489018b7 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 20 Aug 2019 09:58:35 -0400 Subject: [PATCH] Disallow implicit conversion for CFeeRate constructor --- src/policy/feerate.h | 2 +- src/wallet/rpcwallet.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/policy/feerate.h b/src/policy/feerate.h index 85d7d22b4f..d081f2ce8e 100644 --- a/src/policy/feerate.h +++ b/src/policy/feerate.h @@ -25,7 +25,7 @@ class CFeeRate /** Fee rate of 0 satoshis per kB */ CFeeRate() : nSatoshisPerK(0) { } template - CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { + explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { // We've previously had bugs creep in from silent double->int conversion... static_assert(std::is_integral::value, "CFeeRate should be used without floats"); } diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 69dec5f75f..0be74d57d2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2625,7 +2625,7 @@ static UniValue settxfee(const JSONRPCRequest& request) CAmount nAmount = AmountFromValue(request.params[0]); CFeeRate tx_fee_rate(nAmount, 1000); - if (tx_fee_rate == 0) { + if (tx_fee_rate == CFeeRate(0)) { // automatic selection } else if (tx_fee_rate < ::minRelayTxFee) { throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("txfee cannot be less than min relay tx fee (%s)", ::minRelayTxFee.ToString()));