|
|
@ -2496,6 +2496,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) |
|
|
|
" \"changePosition\" (numeric, optional, default random) The index of the change output\n" |
|
|
|
" \"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" |
|
|
|
" \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n" |
|
|
|
" \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n" |
|
|
|
" \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n" |
|
|
|
|
|
|
|
" \"reserveChangeKey\" (boolean, optional, default true) Reserves the change output key from the keypool\n" |
|
|
|
" \"feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific feerate (" + CURRENCY_UNIT + " per KB)\n" |
|
|
|
" \"feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific feerate (" + CURRENCY_UNIT + " per KB)\n" |
|
|
|
" \"subtractFeeFromOutputs\" (array, optional) A json array of integers.\n" |
|
|
|
" \"subtractFeeFromOutputs\" (array, optional) A json array of integers.\n" |
|
|
|
" The fee will be equally deducted from the amount of each specified output.\n" |
|
|
|
" The fee will be equally deducted from the amount of each specified output.\n" |
|
|
@ -2528,6 +2529,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) |
|
|
|
int changePosition = -1; |
|
|
|
int changePosition = -1; |
|
|
|
bool includeWatching = false; |
|
|
|
bool includeWatching = false; |
|
|
|
bool lockUnspents = false; |
|
|
|
bool lockUnspents = false; |
|
|
|
|
|
|
|
bool reserveChangeKey = true; |
|
|
|
CFeeRate feeRate = CFeeRate(0); |
|
|
|
CFeeRate feeRate = CFeeRate(0); |
|
|
|
bool overrideEstimatedFeerate = false; |
|
|
|
bool overrideEstimatedFeerate = false; |
|
|
|
UniValue subtractFeeFromOutputs; |
|
|
|
UniValue subtractFeeFromOutputs; |
|
|
@ -2549,6 +2551,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) |
|
|
|
{"changePosition", UniValueType(UniValue::VNUM)}, |
|
|
|
{"changePosition", UniValueType(UniValue::VNUM)}, |
|
|
|
{"includeWatching", UniValueType(UniValue::VBOOL)}, |
|
|
|
{"includeWatching", UniValueType(UniValue::VBOOL)}, |
|
|
|
{"lockUnspents", UniValueType(UniValue::VBOOL)}, |
|
|
|
{"lockUnspents", UniValueType(UniValue::VBOOL)}, |
|
|
|
|
|
|
|
{"reserveChangeKey", UniValueType(UniValue::VBOOL)}, |
|
|
|
{"feeRate", UniValueType()}, // will be checked below
|
|
|
|
{"feeRate", UniValueType()}, // will be checked below
|
|
|
|
{"subtractFeeFromOutputs", UniValueType(UniValue::VARR)}, |
|
|
|
{"subtractFeeFromOutputs", UniValueType(UniValue::VARR)}, |
|
|
|
}, |
|
|
|
}, |
|
|
@ -2572,6 +2575,9 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) |
|
|
|
if (options.exists("lockUnspents")) |
|
|
|
if (options.exists("lockUnspents")) |
|
|
|
lockUnspents = options["lockUnspents"].get_bool(); |
|
|
|
lockUnspents = options["lockUnspents"].get_bool(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (options.exists("reserveChangeKey")) |
|
|
|
|
|
|
|
reserveChangeKey = options["reserveChangeKey"].get_bool(); |
|
|
|
|
|
|
|
|
|
|
|
if (options.exists("feeRate")) |
|
|
|
if (options.exists("feeRate")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
feeRate = CFeeRate(AmountFromValue(options["feeRate"])); |
|
|
|
feeRate = CFeeRate(AmountFromValue(options["feeRate"])); |
|
|
@ -2608,7 +2614,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) |
|
|
|
CAmount nFeeOut; |
|
|
|
CAmount nFeeOut; |
|
|
|
string strFailReason; |
|
|
|
string strFailReason; |
|
|
|
|
|
|
|
|
|
|
|
if(!pwalletMain->FundTransaction(tx, nFeeOut, overrideEstimatedFeerate, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, setSubtractFeeFromOutputs, changeAddress)) |
|
|
|
if(!pwalletMain->FundTransaction(tx, nFeeOut, overrideEstimatedFeerate, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, setSubtractFeeFromOutputs, reserveChangeKey, changeAddress)) |
|
|
|
throw JSONRPCError(RPC_INTERNAL_ERROR, strFailReason); |
|
|
|
throw JSONRPCError(RPC_INTERNAL_ERROR, strFailReason); |
|
|
|
|
|
|
|
|
|
|
|
UniValue result(UniValue::VOBJ); |
|
|
|
UniValue result(UniValue::VOBJ); |
|
|
|