From 82a31bec3ced65bf201b844d0759e72e29ad1649 Mon Sep 17 00:00:00 2001 From: mk Date: Tue, 28 Mar 2017 20:22:46 +0100 Subject: [PATCH 1/2] new bip148 specification --- src/clientversion.cpp | 2 +- src/validation.cpp | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 30767b6b4a5d2..a5387b6552465 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -100,6 +100,6 @@ std::string FormatSubVersion(const std::string& name, int nClientVersion, const } ss << "/"; if (!fBaseNameOnly) - ss << "UASF-Segwit:0.1.1(BIP148)/"; + ss << "UASF-Segwit:0.1.2(BIP148)/"; return ss.str(); } diff --git a/src/validation.cpp b/src/validation.cpp index ea48f1fba8b02..666160e29e88d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1851,13 +1851,16 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin flags |= SCRIPT_VERIFY_NULLDUMMY; } - // mandatory segwit activation between Oct 1st 2017 and Nov 15th 2017 inclusive - if (pindex->GetMedianTimePast() >= 1506816000 && // Sun Oct 1 00:00:00 UTC 2017 - pindex->GetMedianTimePast() <= 1510704000 && // Wed Nov 15 00:00:00 UTC 2017 - !IsWitnessEnabled(pindex->pprev, chainparams.GetConsensus()) && // segwit not activated yet - ((pindex->nVersion & VERSIONBITS_TOP_MASK) != VERSIONBITS_TOP_BITS || // no BIP9 or no segwit - (pindex->nVersion & VersionBitsMask(chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT)) == 0)) { - return state.DoS(0, error("ConnectBlock(): relayed block must signal for segwit, please upgrade"), REJECT_INVALID, "bad-no-segwit"); + // BIP148 mandatory segwit signalling. + if (pindex->GetMedianTimePast() >= 1501545600 && // Tue 1 Aug 2017 00:00:00 UTC + pindex->GetMedianTimePast() <= 1510704000 && // Wed 15 Nov 2017 00:00:00 UTC + !IsWitnessEnabled(pindex->pprev, chainparams.GetConsensus())) + { + // versionbits topbit and segwit flag must be set. + if ((pindex->nVersion & VERSIONBITS_TOP_MASK) != VERSIONBITS_TOP_BITS || + (pindex->nVersion & VersionBitsMask(chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGWIT)) == 0) { + return state.DoS(0, error("ConnectBlock(): relayed block must signal for segwit, please upgrade"), REJECT_INVALID, "bad-no-segwit"); + } } int64_t nTime2 = GetTimeMicros(); nTimeForks += nTime2 - nTime1; From d475db79a6e4d12075dd07229fc7f1b1f8fae246 Mon Sep 17 00:00:00 2001 From: mk Date: Tue, 28 Mar 2017 23:43:22 +0100 Subject: [PATCH 2/2] indicate major change to UASF code --- src/clientversion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index a5387b6552465..cfa85ae9cdd6e 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -100,6 +100,6 @@ std::string FormatSubVersion(const std::string& name, int nClientVersion, const } ss << "/"; if (!fBaseNameOnly) - ss << "UASF-Segwit:0.1.2(BIP148)/"; + ss << "UASF-Segwit:0.2(BIP148)/"; return ss.str(); }