diff options
author | fanquake <fanquake@gmail.com> | 2023-09-09 11:31:18 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-09-09 11:45:15 +0100 |
commit | e25af11225d9d94ecf7068bf7a9a359268786fbe (patch) | |
tree | b56b62e792da19f80cd57d01020355406b03e24b /src | |
parent | 579c49b3a6169469cf53dc7c9eea5ff19b7bf3a4 (diff) | |
parent | 8d6228fc1fe72db3ac38ab9c853be0256bed5f24 (diff) |
Merge bitcoin/bitcoin#28431: Remove needless `GetTransactionOutputWeight` helper
8d6228fc1fe72db3ac38ab9c853be0256bed5f24 consensus/validation.h: remove needless GetTransactionOutputWeight helper (Antoine Poinsot)
Pull request description:
Introduced in #26567. My bad. Thanks AJ for noticing.
ACKs for top commit:
ajtowns:
utACK 8d6228fc1fe72db3ac38ab9c853be0256bed5f24
Tree-SHA512: cf13647b4aac82fb6a54ae0338e3928e9bdf226ed4f5e91d529996328471744132db2bee9676e0b3f40a8bbe0e0ca51a9e5f91560a84e0f33597290551a1ee18
Diffstat (limited to 'src')
-rw-r--r-- | src/consensus/validation.h | 4 | ||||
-rw-r--r-- | src/wallet/spend.cpp | 2 |
2 files changed, 1 insertions, 5 deletions
diff --git a/src/consensus/validation.h b/src/consensus/validation.h index 8fb638abcf..d5bf08cd61 100644 --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -158,10 +158,6 @@ static inline int64_t GetTransactionInputWeight(const CTxIn& txin) // scriptWitness size is added here because witnesses and txins are split up in segwit serialization. return ::GetSerializeSize(txin, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(txin, PROTOCOL_VERSION) + ::GetSerializeSize(txin.scriptWitness.stack, PROTOCOL_VERSION); } -static inline int64_t GetTransactionOutputWeight(const CTxOut& txout) -{ - return ::GetSerializeSize(txout, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(txout, PROTOCOL_VERSION); -} /** Compute at which vout of the block's coinbase transaction the witness commitment occurs, or -1 if not found */ inline int GetWitnessCommitmentIndex(const CBlock& block) diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 750b6c100b..fd7f279505 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -144,7 +144,7 @@ TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *walle if (is_segwit) weight += 2; // Add the size of the transaction outputs. - for (const auto& txo : tx.vout) weight += GetTransactionOutputWeight(txo); + for (const auto& txo : tx.vout) weight += GetSerializeSize(txo) * WITNESS_SCALE_FACTOR; // Add the size of the transaction inputs as if they were signed. for (uint32_t i = 0; i < txouts.size(); i++) { |