diff --git a/src/policy/policy.h b/src/policy/policy.h --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -88,6 +88,12 @@ * Standard script verification flags that standard transactions will comply * with. However scripts violating these flags may still be present in valid * blocks and we must accept those blocks. + * + * Note that the actual mempool validation flags may be slightly different (see + * GetStandardScriptFlags), however this constant should be set to the most + * restrictive flag set that applies in the current / next upgrade, since it is + * used in numerous parts of the codebase that are unable to access the + * contextual information of which upgrades are currently active. */ static constexpr uint32_t STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS | SCRIPT_VERIFY_DERSIG | diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -475,18 +475,15 @@ // the tip is at the given block. static uint32_t GetStandardScriptFlags(const Consensus::Params ¶ms, const CBlockIndex *pindexTip) { - uint32_t flags = STANDARD_SCRIPT_VERIFY_FLAGS; + // Use the consensus flags for the next block as a basis, and mix in the + // declared-standard flags. + uint32_t flags = GetNextBlockScriptFlags(params, pindexTip) | + STANDARD_SCRIPT_VERIFY_FLAGS; // Disable input sigchecks limit for mempool admission, prior to its // proper activation. flags &= ~SCRIPT_VERIFY_INPUT_SIGCHECKS; - // We make sure this node will have replay protection during the next hard - // fork. - if (IsReplayProtectionEnabled(params, pindexTip)) { - flags |= SCRIPT_ENABLE_REPLAY_PROTECTION; - } - return flags; }