@@ -2496,6 +2496,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
2496
2496
" \" changePosition\" (numeric, optional, default random) The index of the change output\n "
2497
2497
" \" includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n "
2498
2498
" \" lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n "
2499
+ " \" reserveChangeKey\" (boolean, optional, default true) Reserves the change output key from the keypool\n "
2499
2500
" \" feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific feerate (" + CURRENCY_UNIT + " per KB)\n "
2500
2501
" \" subtractFeeFromOutputs\" (array, optional) A json array of integers.\n "
2501
2502
" The fee will be equally deducted from the amount of each specified output.\n "
@@ -2528,6 +2529,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
2528
2529
int changePosition = -1 ;
2529
2530
bool includeWatching = false ;
2530
2531
bool lockUnspents = false ;
2532
+ bool reserveChangeKey = true ;
2531
2533
CFeeRate feeRate = CFeeRate (0 );
2532
2534
bool overrideEstimatedFeerate = false ;
2533
2535
UniValue subtractFeeFromOutputs;
@@ -2549,6 +2551,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
2549
2551
{" changePosition" , UniValueType (UniValue::VNUM)},
2550
2552
{" includeWatching" , UniValueType (UniValue::VBOOL)},
2551
2553
{" lockUnspents" , UniValueType (UniValue::VBOOL)},
2554
+ {" reserveChangeKey" , UniValueType (UniValue::VBOOL)},
2552
2555
{" feeRate" , UniValueType ()}, // will be checked below
2553
2556
{" subtractFeeFromOutputs" , UniValueType (UniValue::VARR)},
2554
2557
},
@@ -2572,6 +2575,9 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
2572
2575
if (options.exists (" lockUnspents" ))
2573
2576
lockUnspents = options[" lockUnspents" ].get_bool ();
2574
2577
2578
+ if (options.exists (" reserveChangeKey" ))
2579
+ reserveChangeKey = options[" reserveChangeKey" ].get_bool ();
2580
+
2575
2581
if (options.exists (" feeRate" ))
2576
2582
{
2577
2583
feeRate = CFeeRate (AmountFromValue (options[" feeRate" ]));
@@ -2608,7 +2614,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
2608
2614
CAmount nFeeOut;
2609
2615
string strFailReason;
2610
2616
2611
- if (!pwalletMain->FundTransaction (tx, nFeeOut, overrideEstimatedFeerate, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, setSubtractFeeFromOutputs, changeAddress))
2617
+ if (!pwalletMain->FundTransaction (tx, nFeeOut, overrideEstimatedFeerate, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, setSubtractFeeFromOutputs, reserveChangeKey, changeAddress))
2612
2618
throw JSONRPCError (RPC_INTERNAL_ERROR, strFailReason);
2613
2619
2614
2620
UniValue result (UniValue::VOBJ);
0 commit comments