mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Disallow implicit conversion for CFeeRate constructor
This commit is contained in:
parent
14463785ad
commit
2f013fde64
2 changed files with 2 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ public:
|
||||||
/** Fee rate of 0 satoshis per kB */
|
/** Fee rate of 0 satoshis per kB */
|
||||||
CFeeRate() : nSatoshisPerK(0) { }
|
CFeeRate() : nSatoshisPerK(0) { }
|
||||||
template<typename I>
|
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...
|
// 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");
|
static_assert(std::is_integral<I>::value, "CFeeRate should be used without floats");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2619,7 +2619,7 @@ static UniValue settxfee(const JSONRPCRequest& request)
|
||||||
|
|
||||||
CAmount nAmount = AmountFromValue(request.params[0]);
|
CAmount nAmount = AmountFromValue(request.params[0]);
|
||||||
CFeeRate tx_fee_rate(nAmount, 1000);
|
CFeeRate tx_fee_rate(nAmount, 1000);
|
||||||
if (tx_fee_rate == 0) {
|
if (tx_fee_rate == CFeeRate(0)) {
|
||||||
// automatic selection
|
// automatic selection
|
||||||
} else if (tx_fee_rate < ::minRelayTxFee) {
|
} else if (tx_fee_rate < ::minRelayTxFee) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("txfee cannot be less than min relay tx fee (%s)", ::minRelayTxFee.ToString()));
|
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("txfee cannot be less than min relay tx fee (%s)", ::minRelayTxFee.ToString()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue