Skip to content

Commit 8d6228f

Browse files
committed
consensus/validation.h: remove needless GetTransactionOutputWeight helper
Introduced in 9b7ec39. This copied the format of the other Get.*Weight helpers but it's useless for a CTxOut.
1 parent d2ccca2 commit 8d6228f

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)