From 0ac19a98f329fe8952f394509a7a29775ab805b0 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Thu, 9 Jan 2025 12:05:58 +0100 Subject: [PATCH] doc: warn that CheckBlock() underestimates sigops Counting sigops in the witness requires context that CheckBlock() does not have, so it only counts sigops for non-segwit transactions. It's useful to document, but it should not be a problem. --- src/validation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/validation.cpp b/src/validation.cpp index 3e8a7cf520e..f2fb2da6f1b 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4094,6 +4094,7 @@ bool CheckBlock(const CBlock& block, BlockValidationState& state, const Consensu strprintf("Transaction check failed (tx hash %s) %s", tx->GetHash().ToString(), tx_state.GetDebugMessage())); } } + // This underestimates the number of sigops, because unlike ConnectBlock it does not count the witness: unsigned int nSigOps = 0; for (const auto& tx : block.vtx) {