diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h --- a/src/consensus/consensus.h +++ b/src/consensus/consensus.h @@ -18,11 +18,6 @@ static const uint64_t LEGACY_MAX_BLOCK_SIZE = ONE_MEGABYTE; /** Default setting for maximum allowed size for a block, in bytes */ static const uint64_t DEFAULT_MAX_BLOCK_SIZE = 32 * ONE_MEGABYTE; -/** - * The maximum allowed number of parsed signature check operations (SigOps) - * per MB in a block (network rule). - */ -static const int64_t MAX_BLOCK_SIGOPS_PER_MB = 20000; /** allowed number of signature check operations (sigops) per transaction. */ static const uint64_t MAX_TX_SIGOPS_COUNT = 20000; /** Allowed number of signature check operations per transaction. */ @@ -46,17 +41,6 @@ /** Use GetMedianTimePast() instead of nTime for end point timestamp. */ static constexpr unsigned int LOCKTIME_MEDIAN_TIME_PAST = (1 << 1); -/** - * Compute the maximum number of sigops operation that can contained in a block - * given the block size as parameter. It is computed by multiplying - * MAX_BLOCK_SIGOPS_PER_MB by the size of the block in MB rounded up to the - * closest integer. - */ -inline uint64_t GetMaxBlockSigOpsCount(uint64_t blockSize) { - auto nMbRoundedUp = 1 + ((blockSize - 1) / ONE_MEGABYTE); - return nMbRoundedUp * MAX_BLOCK_SIGOPS_PER_MB; -} - /** * Compute the maximum number of sigchecks that can be contained in a block * given the MAXIMUM block size as parameter. The maximum sigchecks scale diff --git a/src/policy/policy.h b/src/policy/policy.h --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -59,8 +59,7 @@ /** * Default for -bytespersigop . */ -static const unsigned int DEFAULT_BYTES_PER_SIGOP = - 1000000 / MAX_BLOCK_SIGOPS_PER_MB; +static const unsigned int DEFAULT_BYTES_PER_SIGOP = 50; /** Default for -permitbaremultisig */ static const bool DEFAULT_PERMIT_BAREMULTISIG = true; /** diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1709,12 +1709,6 @@ Amount nFees = Amount::zero(); int nInputs = 0; - // Sigops counting. We need to do it again because of P2SH. - uint64_t nSigOpsCount = 0; - const uint64_t currentBlockSize = - ::GetSerializeSize(block, PROTOCOL_VERSION); - const uint64_t nMaxSigOpsCount = GetMaxBlockSigOpsCount(currentBlockSize); - // Limit the total executed signature operations in the block, a consensus // rule. Tracking during the CPU-consuming part (validation of uncached // inputs) is per-input atomic and validation in each thread stops very @@ -1780,12 +1774,6 @@ return state.DoS(100, false, REJECT_INVALID, "bad-txn-sigops"); } - nSigOpsCount += txSigOpsCount; - if (nSigOpsCount > nMaxSigOpsCount) { - return state.DoS(100, error("ConnectBlock(): too many sigops"), - REJECT_INVALID, "bad-blk-sigops"); - } - // The following checks do not apply to the coinbase. if (isCoinBase) { continue; @@ -3703,10 +3691,6 @@ const bool fIsMagneticAnomalyEnabled = IsMagneticAnomalyEnabled(params, pindexPrev); - // Keep track of the sigops count. - uint64_t nSigOps = 0; - const auto currentBlockSize = ::GetSerializeSize(block, PROTOCOL_VERSION); - auto nMaxSigOpsCount = GetMaxBlockSigOpsCount(currentBlockSize); // Note that pindexPrev may be null if reindexing genesis block. const auto scriptFlags = pindexPrev ? GetNextBlockScriptFlags(params, pindexPrev) @@ -3750,11 +3734,6 @@ return state.DoS(100, false, REJECT_INVALID, "bad-txn-sigops", false, "out-of-bounds SigOpCount"); } - nSigOps += txSigOps; - if (nSigOps > nMaxSigOpsCount) { - return state.DoS(100, false, REJECT_INVALID, "bad-blk-sigops", - false, "out-of-bounds SigOpCount"); - } if (!ContextualCheckTransaction(params, tx, state, nHeight, nLockTimeCutoff, nMedianTimePast)) {