Add checks for settxfee reasonableness
This commit is contained in:
parent
b5591ca0b0
commit
48618daf26
1 changed files with 9 additions and 1 deletions
|
@ -2982,8 +2982,16 @@ static UniValue settxfee(const JSONRPCRequest& request)
|
||||||
LOCK2(cs_main, pwallet->cs_wallet);
|
LOCK2(cs_main, pwallet->cs_wallet);
|
||||||
|
|
||||||
CAmount nAmount = AmountFromValue(request.params[0]);
|
CAmount nAmount = AmountFromValue(request.params[0]);
|
||||||
|
CFeeRate tx_fee_rate(nAmount, 1000);
|
||||||
|
if (tx_fee_rate == 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()));
|
||||||
|
} else if (tx_fee_rate < pwallet->m_min_fee) {
|
||||||
|
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("txfee cannot be less than wallet min fee (%s)", pwallet->m_min_fee.ToString()));
|
||||||
|
}
|
||||||
|
|
||||||
pwallet->m_pay_tx_fee = CFeeRate(nAmount, 1000);
|
pwallet->m_pay_tx_fee = tx_fee_rate;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue