Skip to content

Commit e25af11

Browse files
committed
Merge bitcoin/bitcoin#28431: Remove needless GetTransactionOutputWeight helper
8d6228f 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 8d6228f Tree-SHA512: cf13647b4aac82fb6a54ae0338e3928e9bdf226ed4f5e91d529996328471744132db2bee9676e0b3f40a8bbe0e0ca51a9e5f91560a84e0f33597290551a1ee18
2 parents 579c49b + 8d6228f commit e25af11

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/consensus/validation.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ static inline int64_t GetTransactionInputWeight(const CTxIn& txin)
158158
// scriptWitness size is added here because witnesses and txins are split up in segwit serialization.
159159
return ::GetSerializeSize(txin, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(txin, PROTOCOL_VERSION) + ::GetSerializeSize(txin.scriptWitness.stack, PROTOCOL_VERSION);
160160
}
161-
static inline int64_t GetTransactionOutputWeight(const CTxOut& txout)
162-
{
163-
return ::GetSerializeSize(txout, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(txout, PROTOCOL_VERSION);
164-
}
165161

166162
/** Compute at which vout of the block's coinbase transaction the witness commitment occurs, or -1 if not found */
167163
inline int GetWitnessCommitmentIndex(const CBlock& block)

src/wallet/spend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *walle
144144
if (is_segwit) weight += 2;
145145

146146
// Add the size of the transaction outputs.
147-
for (const auto& txo : tx.vout) weight += GetTransactionOutputWeight(txo);
147+
for (const auto& txo : tx.vout) weight += GetSerializeSize(txo) * WITNESS_SCALE_FACTOR;
148148

149149
// Add the size of the transaction inputs as if they were signed.
150150
for (uint32_t i = 0; i < txouts.size(); i++) {

0 commit comments

Comments
 (0)