aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-01-04 16:13:30 +0800
committerfanquake <fanquake@gmail.com>2020-01-04 17:09:52 +0800
commit310b29f9c326a14060c3c0b0561cd59af7d3c1e5 (patch)
treecb1eaeb2746db10c41c4dd907e01dd0d0d9708f9 /src
parenta284bbbee805cd03664fd27656795a9f7d3eeca7 (diff)
parentbd8c6f12e805115b5f8f7b608061008027f4a793 (diff)
downloadbitcoin-310b29f9c326a14060c3c0b0561cd59af7d3c1e5.tar.xz
Merge #17859: [0.19] Fix origfee return for bumpfee with feerate arg
bd8c6f12e805115b5f8f7b608061008027f4a793 Fix origfee return for bumpfee with feerate arg (Gregory Sanders) Pull request description: Backport of Github-Pull: #17643 Rebased-From: 02afb0c550dc8529918460c845d1da3adf236eed ACKs for top commit: fanquake: ACK bd8c6f12e805115b5f8f7b608061008027f4a793 - the appveyor failure is unrelated. instagibbs: utACK https://github.com/bitcoin/bitcoin/pull/17859/commits/bd8c6f12e805115b5f8f7b608061008027f4a793 Tree-SHA512: 7e420a3fe02503194b6fc8eae5277c46289cd6abe131b2513ad80422819e6bafbc7768e7be344d4132ebdbc24846d459ba2a271be184725d818dff77510fa4de
Diffstat (limited to 'src')
-rw-r--r--src/wallet/feebumper.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp
index b87231293f..cb2fe37fc9 100644
--- a/src/wallet/feebumper.cpp
+++ b/src/wallet/feebumper.cpp
@@ -109,12 +109,11 @@ static feebumper::Result CheckFeeRate(const CWallet* wallet, const CWalletTx& wt
return feebumper::Result::OK;
}
-static CFeeRate EstimateFeeRate(CWallet* wallet, const CWalletTx& wtx, CCoinControl& coin_control, CAmount& old_fee)
+static CFeeRate EstimateFeeRate(CWallet* wallet, const CWalletTx& wtx, const CAmount old_fee, CCoinControl& coin_control)
{
// Get the fee rate of the original transaction. This is calculated from
// the tx fee/vsize, so it may have been rounded down. Add 1 satoshi to the
// result.
- old_fee = wtx.GetDebit(ISMINE_SPENDABLE) - wtx.tx->GetValueOut();
int64_t txSize = GetVirtualTransactionSize(*(wtx.tx));
CFeeRate feerate(old_fee, txSize);
feerate += CFeeRate(1);
@@ -310,6 +309,8 @@ Result CreateRateBumpTransaction(CWallet* wallet, const uint256& txid, const CCo
}
}
+ old_fee = wtx.GetDebit(ISMINE_SPENDABLE) - wtx.tx->GetValueOut();
+
if (coin_control.m_feerate) {
// The user provided a feeRate argument.
// We calculate this here to avoid compiler warning on the cs_wallet lock
@@ -320,7 +321,7 @@ Result CreateRateBumpTransaction(CWallet* wallet, const uint256& txid, const CCo
}
} else {
// The user did not provide a feeRate argument
- new_coin_control.m_feerate = EstimateFeeRate(wallet, wtx, new_coin_control, old_fee);
+ new_coin_control.m_feerate = EstimateFeeRate(wallet, wtx, old_fee, new_coin_control);
}
// Fill in required inputs we are double-spending(all of them)