aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-08-17 11:36:45 -0400
committerAndrew Chow <achow101-github@achow101.com>2022-08-19 11:27:01 -0400
commit31dd3dc9e5b27fa2bbb5170ad98107a36fe55958 (patch)
tree8bad811e56b8a7017919dab373451882ffbb3d99 /src/wallet
parenta0c3afb898016c2e0a76dc48f68eaa5c3ae6282c (diff)
downloadbitcoin-31dd3dc9e5b27fa2bbb5170ad98107a36fe55958.tar.xz
bumpfee: Clear scriptSigs and scriptWitnesses before calculated max size
The max size calculation expects some inputs to have empty scriptSigs and witnesses, so we need to clear these before doing that calculation.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/feebumper.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp
index d2e3f07301..c0d2ca3240 100644
--- a/src/wallet/feebumper.cpp
+++ b/src/wallet/feebumper.cpp
@@ -242,7 +242,13 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
if (coin_control.m_feerate) {
// The user provided a feeRate argument.
// We calculate this here to avoid compiler warning on the cs_wallet lock
- const int64_t maxTxSize{CalculateMaximumSignedTxSize(*wtx.tx, &wallet, &new_coin_control).vsize};
+ // We need to make a temporary transaction with no input witnesses as the dummy signer expects them to be empty for external inputs
+ CMutableTransaction mtx{*wtx.tx};
+ for (auto& txin : mtx.vin) {
+ txin.scriptSig.clear();
+ txin.scriptWitness.SetNull();
+ }
+ const int64_t maxTxSize{CalculateMaximumSignedTxSize(CTransaction(mtx), &wallet, &new_coin_control).vsize};
Result res = CheckFeeRate(wallet, wtx, *new_coin_control.m_feerate, maxTxSize, old_fee, errors);
if (res != Result::OK) {
return res;