@@ -2458,6 +2458,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
24582458 " \" changePosition\" (numeric, optional, default random) The index of the change output\n "
24592459 " \" includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n "
24602460 " \" lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n "
2461+ " \" feeRate\" (numeric, optional, default 0=estimate) Set a specific feerate (fee per KB)\n "
24612462 " }\n "
24622463 " for backward compatibility: passing in a true instead of an object will result in {\" includeWatching\" :true}\n "
24632464 " \n Result:\n "
@@ -2484,6 +2485,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
24842485 int changePosition = -1 ;
24852486 bool includeWatching = false ;
24862487 bool lockUnspents = false ;
2488+ CFeeRate feeRate = CFeeRate (0 );
24872489
24882490 if (params.size () > 1 ) {
24892491 if (params[1 ].type () == UniValue::VBOOL) {
@@ -2495,7 +2497,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
24952497
24962498 UniValue options = params[1 ];
24972499
2498- RPCTypeCheckObj (options, boost::assign::map_list_of (" changeAddress" , UniValue::VSTR)(" changePosition" , UniValue::VNUM)(" includeWatching" , UniValue::VBOOL)(" lockUnspents" , UniValue::VBOOL), true , true );
2500+ RPCTypeCheckObj (options, boost::assign::map_list_of (" changeAddress" , UniValue::VSTR)(" changePosition" , UniValue::VNUM)(" includeWatching" , UniValue::VBOOL)(" lockUnspents" , UniValue::VBOOL)( " feeRate " , UniValue::VNUM) , true , true );
24992501
25002502 if (options.exists (" changeAddress" )) {
25012503 CBitcoinAddress address (options[" changeAddress" ].get_str ());
@@ -2514,6 +2516,9 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
25142516
25152517 if (options.exists (" lockUnspents" ))
25162518 lockUnspents = options[" lockUnspents" ].get_bool ();
2519+
2520+ if (options.exists (" feeRate" ))
2521+ feeRate = CFeeRate (options[" feeRate" ].get_real ());
25172522 }
25182523 }
25192524
@@ -2529,16 +2534,16 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
25292534 throw JSONRPCError (RPC_INVALID_PARAMETER, " changePosition out of bounds" );
25302535
25312536 CMutableTransaction tx (origTx);
2532- CAmount nFee ;
2537+ CAmount nFeeOut ;
25332538 string strFailReason;
25342539
2535- if (!pwalletMain->FundTransaction (tx, nFee , changePosition, strFailReason, includeWatching, lockUnspents, changeAddress))
2540+ if (!pwalletMain->FundTransaction (tx, nFeeOut, feeRate , changePosition, strFailReason, includeWatching, lockUnspents, changeAddress))
25362541 throw JSONRPCError (RPC_INTERNAL_ERROR, strFailReason);
25372542
25382543 UniValue result (UniValue::VOBJ);
25392544 result.push_back (Pair (" hex" , EncodeHexTx (tx)));
25402545 result.push_back (Pair (" changepos" , changePosition));
2541- result.push_back (Pair (" fee" , ValueFromAmount (nFee )));
2546+ result.push_back (Pair (" fee" , ValueFromAmount (nFeeOut )));
25422547
25432548 return result;
25442549}
0 commit comments