diff --git a/src/validation.cpp b/src/validation.cpp index 9f99b5b4e..7b9c20f4d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1869,15 +1869,6 @@ public: static ThresholdConditionCache warningcache[VERSIONBITS_NUM_BITS] GUARDED_BY(cs_main); -// 0.13.0 was shipped with a segwit deployment defined for testnet, but not for -// mainnet. We no longer need to support disabling the segwit deployment -// except for testing purposes, due to limitations of the functional test -// environment. See test/functional/p2p-segwit.py. -static bool IsScriptWitnessEnabled(const Consensus::Params& params) -{ - return params.SegwitHeight != std::numeric_limits::max(); -} - static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consensus::Params& consensusparams) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { AssertLockHeld(cs_main); @@ -1888,12 +1879,6 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consens flags |= SCRIPT_VERIFY_P2SH; } - // Enforce WITNESS rules whenever P2SH is in effect (and the segwit - // deployment is defined). - if (flags & SCRIPT_VERIFY_P2SH && IsScriptWitnessEnabled(consensusparams)) { - flags |= SCRIPT_VERIFY_WITNESS; - } - // Start enforcing the DERSIG (BIP66) rule if (pindex->nHeight >= consensusparams.BIP66Height) { flags |= SCRIPT_VERIFY_DERSIG; @@ -1916,6 +1901,7 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consens // Start enforcing BIP147 NULLDUMMY (activated simultaneously with segwit) if (IsWitnessEnabled(pindex->pprev, consensusparams)) { + flags |= SCRIPT_VERIFY_WITNESS; flags |= SCRIPT_VERIFY_NULLDUMMY; } diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 91d259a0a..9aded5449 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -556,7 +556,9 @@ class SegWitTest(BitcoinTestFramework): # 'non-mandatory-script-verify-flag (Witness program was passed an # empty witness)' (otherwise). # TODO: support multiple acceptable reject reasons. - test_witness_block(self.nodes[0], self.test_node, block, accepted=False, with_witness=False) + # Litecoin: BTC applied these rules for all transactions once P2SH is enabled, on LTC we enforce + # these rules only when segwit was activated + # test_witness_block(self.nodes[0], self.test_node, block, accepted=False, with_witness=False) self.connect_nodes(0, 2)