Skip to content

Commit

Permalink
Disallow implicit conversion for CFeeRate constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Oct 14, 2019
1 parent 36fceda commit 130d190
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/policy/feerate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CFeeRate
/** Fee rate of 0 satoshis per kB */
CFeeRate() : nSatoshisPerK(0) { }
template<typename I>
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<I>::value, "CFeeRate should be used without floats");
}
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit 130d190

Please sign in to comment.