Skip to content

Commit

Permalink
Merge bitcoin#28431: Remove needless GetTransactionOutputWeight helper
Browse files Browse the repository at this point in the history
8d6228f consensus/validation.h: remove needless GetTransactionOutputWeight helper (Antoine Poinsot)

Pull request description:

  Introduced in bitcoin#26567. My bad. Thanks AJ for noticing.

ACKs for top commit:
  ajtowns:
    utACK 8d6228f

Tree-SHA512: cf13647b4aac82fb6a54ae0338e3928e9bdf226ed4f5e91d529996328471744132db2bee9676e0b3f40a8bbe0e0ca51a9e5f91560a84e0f33597290551a1ee18
  • Loading branch information
fanquake authored and Frank-GER committed Sep 13, 2023
1 parent d042ef9 commit 673fe98
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions src/consensus/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,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)
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/spend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 673fe98

Please sign in to comment.