mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
[rpc] fundrawtransaction feeRate: Use BTC/kB
Also introduce UniValueType UniValueType is a wrapper for UniValue::VType which allows setting a typeAny flag. This flag indicates the type does not matter. (Used by RPCTypeCheckObj)
This commit is contained in:
@@ -2069,7 +2069,11 @@ UniValue lockunspent(const UniValue& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object");
|
||||
const UniValue& o = output.get_obj();
|
||||
|
||||
RPCTypeCheckObj(o, boost::assign::map_list_of("txid", UniValue::VSTR)("vout", UniValue::VNUM));
|
||||
RPCTypeCheckObj(o,
|
||||
{
|
||||
{"txid", UniValueType(UniValue::VSTR)},
|
||||
{"vout", UniValueType(UniValue::VNUM)},
|
||||
});
|
||||
|
||||
string txid = find_value(o, "txid").get_str();
|
||||
if (!IsHex(txid))
|
||||
@@ -2369,7 +2373,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
||||
" \"changePosition\" (numeric, optional, default random) The index of the change output\n"
|
||||
" \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n"
|
||||
" \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n"
|
||||
" \"feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific feerate (satoshis per KB)\n"
|
||||
" \"feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific feerate (" + CURRENCY_UNIT + " per KB)\n"
|
||||
" }\n"
|
||||
" for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}\n"
|
||||
"\nResult:\n"
|
||||
@@ -2409,7 +2413,15 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
||||
|
||||
UniValue options = params[1];
|
||||
|
||||
RPCTypeCheckObj(options, boost::assign::map_list_of("changeAddress", UniValue::VSTR)("changePosition", UniValue::VNUM)("includeWatching", UniValue::VBOOL)("lockUnspents", UniValue::VBOOL)("feeRate", UniValue::VNUM), true, true);
|
||||
RPCTypeCheckObj(options,
|
||||
{
|
||||
{"changeAddress", UniValueType(UniValue::VSTR)},
|
||||
{"changePosition", UniValueType(UniValue::VNUM)},
|
||||
{"includeWatching", UniValueType(UniValue::VBOOL)},
|
||||
{"lockUnspents", UniValueType(UniValue::VBOOL)},
|
||||
{"feeRate", UniValueType()}, // will be checked below
|
||||
},
|
||||
true, true);
|
||||
|
||||
if (options.exists("changeAddress")) {
|
||||
CBitcoinAddress address(options["changeAddress"].get_str());
|
||||
@@ -2431,7 +2443,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
||||
|
||||
if (options.exists("feeRate"))
|
||||
{
|
||||
feeRate = CFeeRate(options["feeRate"].get_real());
|
||||
feeRate = CFeeRate(AmountFromValue(options["feeRate"]));
|
||||
overrideEstimatedFeerate = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user