@@ -108,12 +108,11 @@ static feebumper::Result CheckFeeRate(const CWallet& wallet, const CWalletTx& wt
108108 return feebumper::Result::OK;
109109}
110110
111- static CFeeRate EstimateFeeRate (const CWallet& wallet, const CWalletTx& wtx, CCoinControl& coin_control, CAmount& old_fee )
111+ static CFeeRate EstimateFeeRate (const CWallet& wallet, const CWalletTx& wtx, const CAmount old_fee, CCoinControl& coin_control )
112112{
113113 // Get the fee rate of the original transaction. This is calculated from
114114 // the tx fee/vsize, so it may have been rounded down. Add 1 satoshi to the
115115 // result.
116- old_fee = wtx.GetDebit (ISMINE_SPENDABLE) - wtx.tx ->GetValueOut ();
117116 int64_t txSize = GetVirtualTransactionSize (*(wtx.tx ));
118117 CFeeRate feerate (old_fee, txSize);
119118 feerate += CFeeRate (1 );
@@ -309,6 +308,8 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
309308 }
310309 }
311310
311+ old_fee = wtx.GetDebit (ISMINE_SPENDABLE) - wtx.tx ->GetValueOut ();
312+
312313 if (coin_control.m_feerate ) {
313314 // The user provided a feeRate argument.
314315 // We calculate this here to avoid compiler warning on the cs_wallet lock
@@ -319,7 +320,7 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
319320 }
320321 } else {
321322 // The user did not provide a feeRate argument
322- new_coin_control.m_feerate = EstimateFeeRate (wallet, wtx, new_coin_control, old_fee );
323+ new_coin_control.m_feerate = EstimateFeeRate (wallet, wtx, old_fee, new_coin_control );
323324 }
324325
325326 // Fill in required inputs we are double-spending(all of them)
0 commit comments