wallet: fundrawtx fee rate coverage, fixup ParseConfirmTarget()

This commit is contained in:
Jon Atack
2020-10-19 11:35:10 +02:00
parent 2d8eba8f84
commit 3ac7b0c6f1
2 changed files with 60 additions and 4 deletions

View File

@@ -272,11 +272,12 @@ UniValue DescribeAddress(const CTxDestination& dest)
unsigned int ParseConfirmTarget(const UniValue& value, unsigned int max_target)
{
int target = value.get_int();
if (target < 1 || (unsigned int)target > max_target) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid conf_target, must be between %u - %u", 1, max_target));
const int target{value.get_int()};
const unsigned int unsigned_target{static_cast<unsigned int>(target)};
if (target < 1 || unsigned_target > max_target) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid conf_target, must be between %u and %u", 1, max_target));
}
return (unsigned int)target;
return unsigned_target;
}
RPCErrorCode RPCErrorFromTransactionError(TransactionError terr)