diff options
author | Cameron Garnham <da2ce7@gmail.com> | 2017-04-04 12:30:31 +0200 |
---|---|---|
committer | Cameron Garnham <da2ce7@gmail.com> | 2017-04-04 20:05:43 +0200 |
commit | 1352c367a1431fef1a711edeb239fa822a564c4b (patch) | |
tree | 272301adf71820b01d1f1abf2453adc8ea9d995a /bip-0148.mediawiki | |
parent | 2a97af80db8e82d77e1d40968f39774319e23868 (diff) |
Stop BIP 148 enforced signalling if SegWit is Locked-In State
Diffstat (limited to 'bip-0148.mediawiki')
-rw-r--r-- | bip-0148.mediawiki | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bip-0148.mediawiki b/bip-0148.mediawiki index 5accfcf..6eb9c42 100644 --- a/bip-0148.mediawiki +++ b/bip-0148.mediawiki @@ -37,14 +37,22 @@ While this BIP is active, all blocks must set the nVersion header top 3 bits to === Reference implementation === <pre> +// Check if Segregated Witness is Locked In +bool IsWitnessLockedIn(const CBlockIndex* pindexPrev, const Consensus::Params& params) +{ + LOCK(cs_main); + return (VersionBitsState(pindexPrev, params, Consensus::DEPLOYMENT_SEGWIT, versionbitscache) == THRESHOLD_LOCKED_IN); +} + // BIP148 mandatory segwit signalling. int64_t nMedianTimePast = pindex->GetMedianTimePast(); if ( (nMedianTimePast >= 1501545600) && // Tue 01 Aug 2017 00:00:00 UTC (nMedianTimePast <= 1510704000) && // Wed 15 Nov 2017 00:00:00 UTC - (!IsWitnessEnabled(pindex->pprev, chainparams.GetConsensus())) ) // Segwit is not active + (!IsWitnessLockedIn(pindex->pprev, chainparams.GetConsensus()) && // Segwit is not locked in + !IsWitnessEnabled(pindex->pprev, chainparams.GetConsensus())) ) // and is not active. { - bool fVersionBits = (pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS; // BIP9 bit set - bool fSegbit = (pindex->nVersion & VersionBitsMask(chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT)) != 0; // segwit bit set + bool fVersionBits = (pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS; + bool fSegbit = (pindex->nVersion & VersionBitsMask(chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT)) != 0; if (!(fVersionBits && fSegbit)) { return state.DoS(0, error("ConnectBlock(): relayed block must signal for segwit, please upgrade"), REJECT_INVALID, "bad-no-segwit"); } |