Litecoin: Validation

This commit is contained in:
Adrian Gallagher 2020-12-28 21:43:15 -08:00
parent 478dabad29
commit 5f4e932069
No known key found for this signature in database
GPG Key ID: FE3348877809386C
2 changed files with 4 additions and 16 deletions

View File

@ -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<int>::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;
}

View File

@ -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)