mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Trivial: Fix validation comments
- Move comment about transaction/block weight calculation so it applies not only to the GetBlockWeight function but also to GetTransactionWeight - Fix comment in validation.cpp referencing future deployment of BIP113. It has already been deployed. - The doc comment for BLOCK_DOWNLOAD_WINDOW wasn't updated since pruning was introduced, so it still refers to pruning as something that might happen in the future. A larger BLOCK_DOWNLOAD_WINDOW window would now, indeed, make pruning harder.
This commit is contained in:
@@ -89,17 +89,16 @@ public:
|
||||
std::string GetDebugMessage() const { return strDebugMessage; }
|
||||
};
|
||||
|
||||
// These implement the weight = (stripped_size * 4) + witness_size formula,
|
||||
// using only serialization with and without witness data. As witness_size
|
||||
// is equal to total_size - stripped_size, this formula is identical to:
|
||||
// weight = (stripped_size * 3) + total_size.
|
||||
static inline int64_t GetTransactionWeight(const CTransaction& tx)
|
||||
{
|
||||
return ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR -1) + ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
return ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
}
|
||||
|
||||
static inline int64_t GetBlockWeight(const CBlock& block)
|
||||
{
|
||||
// This implements the weight = (stripped_size * 4) + witness_size formula,
|
||||
// using only serialization with and without witness data. As witness_size
|
||||
// is equal to total_size - stripped_size, this formula is identical to:
|
||||
// weight = (stripped_size * 3) + total_size.
|
||||
return ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user