Skip to content

Commit 64c1527

Browse files
committed
fixup Implement block size/sigop cost rules, limits, and GBT support: update block cost comment
1 parent bb2bfca commit 64c1527

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/primitives/block.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ std::string CBlock::ToString() const
3434

3535
int64_t GetBlockCost(const CBlock& block)
3636
{
37-
// The intended approximate formula is: cost = base_size * 4 + witness_size.
38-
// We can only serialize base or base+witness, so the formula
39-
// becomes: cost = base_size * 3 + total_size.
37+
// This implements the cost = base_size * 4 + witness_size formula, using only
38+
// serialization with and without witness data. As witness_size is equal to
39+
// total_size - base_size, this formula is identical to:
40+
// cost = base_size * 3 + total_size.
4041
return ::GetSerializeSize(block, SER_NETWORK, 0) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(block, SER_NETWORK, SERIALIZE_TRANSACTION_WITNESS);
4142
}

0 commit comments

Comments
 (0)