Fixes #7963
Currently fundrawtransaction always uses the default confirm target to estimate the fee (with a fallback to payTxFee).
This PR adds an optional feeRate parameter to fundrawtransaction that overrides the estimated minimum fee.
Fixes #7963
Currently fundrawtransaction always uses the default confirm target to estimate the fee (with a fallback to payTxFee).
This PR adds an optional feeRate parameter to fundrawtransaction that overrides the estimated minimum fee.
2243 | @@ -2242,6 +2244,8 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt 2244 | if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) { 2245 | nFeeNeeded = coinControl->nMinimumTotalFee; 2246 | } 2247 | + if (coinControl && coinControl->nFeeRate > CFeeRate(0)) 2248 | + nFeeNeeded = coinControl->nFeeRate.GetFee(nBytes);
Concept ACK. Though should we be using '0' as a special marker value? What if you want to override it to 0? I think I'd prefer an explicit boolean 'overrideFeeRate'.
Yes. We could use an extra boolean (like overrideFeeRate). My thoughts where that a CFeeRate(0) is not practical but I agree, it would technically be possible to use a zero feerate. I'll add the bool.
Added a commit that add an explicit boolean for overriding the estimated fee rate (overrideFeeRate). This would allow to use 0 as fee rate (zero fee transaction) but would require 0 as minRelayTxFee.
utACK 04eaa9095813b854c4299027c595fb9ebaf6f934
utACK 04eaa90
676 | @@ -677,6 +677,14 @@ def run_test(self): 677 | assert(signedtx["complete"]) 678 | self.nodes[0].sendrawtransaction(signedtx["hex"]) 679 | 680 | + inputs = [] 681 | + outputs = {self.nodes[2].getnewaddress() : 1} 682 | + rawtx = self.nodes[3].createrawtransaction(inputs, outputs) 683 | + result = self.nodes[3].fundrawtransaction(rawtx, )
Nit: empty arg.
Nit: Missing comment mentioning that min_relay_tx_fee=1000 is used.
(Comments help to identify the issue when something breaks)
2457 | @@ -2458,6 +2458,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp) 2458 | " \"changePosition\" (numeric, optional, default random) The index of the change output\n" 2459 | " \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n" 2460 | " \"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"
the default is not "estimate" but whatever happens to be set by the user on startup or after startup.
Either make it default 0 or default not set.
Post merge utACK 04eaa90