Skip to content

Commit bab79c2

Browse files
committed
Update BIP91 confirmation window and enforcement.
1 parent 4ae7ece commit bab79c2

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

bip-0091.mediawiki

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,52 @@ This BIP provides a way for a simple majority of miners to coordinate activation
2828

2929
==Specification==
3030

31-
While this BIP is active, all blocks must set the nVersion header top 3 bits to 001 together with bit field (1<<1) (according to the existing segwit deployment). Blocks that do not signal as required will be rejected.
31+
While this BIP is active or locked in, all blocks must set the nVersion header top 3 bits to 001 together with bit field (1<<1) (according to the existing segwit deployment). Blocks that do not signal as required will be rejected.
3232

3333
==Deployment==
3434

35-
This BIP will be deployed by a "version bits" with an 80%(this can be adjusted if desired) activation threshold BIP9 with the name "segsignal" and using bit 4.
35+
This BIP will be deployed by a "version bits" with an 80%(this can be adjusted if desired) 538 block activation threshold and 672 block confirmation window BIP9 with the name "segsignal" and using bit 4.
3636

3737
This BIP will have a start time of midnight June 1st, 2017 (epoch time 1496275200) and timeout on midnight November 15th 2017 (epoch time 1510704000). This BIP will cease to be active when segwit is locked-in.
3838

3939
=== Reference implementation ===
4040

4141
<pre>
42+
// Deployment of SEGSIGNAL
43+
consensus.vDeployments[Consensus::DEPLOYMENT_SEGSIGNAL].bit = 4;
44+
consensus.vDeployments[Consensus::DEPLOYMENT_SEGSIGNAL].nStartTime = 1496275200; // June 1st, 2017.
45+
consensus.vDeployments[Consensus::DEPLOYMENT_SEGSIGNAL].nTimeout = 1510704000; // November 15th, 2017.
46+
consensus.vDeployments[Consensus::DEPLOYMENT_SEGSIGNAL].nOverrideMinerConfirmationWindow = 672; // ~4.67 days
47+
consensus.vDeployments[Consensus::DEPLOYMENT_SEGSIGNAL].nOverrideRuleChangeActivationThreshold = 538; // 80%
48+
49+
class VersionBitsConditionChecker : public AbstractThresholdConditionChecker {
50+
private:
51+
const Consensus::DeploymentPos id;
52+
53+
protected:
54+
int64_t BeginTime(const Consensus::Params& params) const { return params.vDeployments[id].nStartTime; }
55+
int64_t EndTime(const Consensus::Params& params) const { return params.vDeployments[id].nTimeout; }
56+
int Period(const Consensus::Params& params) const {
57+
if (params.vDeployments[id].nOverrideMinerConfirmationWindow > 0)
58+
return params.vDeployments[id].nOverrideMinerConfirmationWindow;
59+
return params.nMinerConfirmationWindow;
60+
}
61+
int Threshold(const Consensus::Params& params) const {
62+
if (params.vDeployments[id].nOverrideRuleChangeActivationThreshold > 0)
63+
return params.vDeployments[id].nOverrideRuleChangeActivationThreshold;
64+
return params.nRuleChangeActivationThreshold;
65+
}
66+
67+
bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const
68+
{
69+
return (((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) && (pindex->nVersion & Mask(params)) != 0);
70+
}
71+
72+
public:
73+
VersionBitsConditionChecker(Consensus::DeploymentPos id_) : id(id_) {}
74+
uint32_t Mask(const Consensus::Params& params) const { return ((uint32_t)1) << params.vDeployments[id].bit; }
75+
};
76+
4277
// Check if Segregated Witness is Locked In
4378
bool IsWitnessLockedIn(const CBlockIndex* pindexPrev, const Consensus::Params& params)
4479
{
@@ -47,7 +82,8 @@ bool IsWitnessLockedIn(const CBlockIndex* pindexPrev, const Consensus::Params& p
4782
}
4883

4984
// SEGSIGNAL mandatory segwit signalling.
50-
if ( VersionBitsState(pindex->pprev, chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGSIGNAL, versionbitscache) == THRESHOLD_ACTIVE &&
85+
if ((VersionBitsState(pindex->pprev, chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGSIGNAL, versionbitscache) == THRESHOLD_ACTIVE ||
86+
VersionBitsState(pindex->pprev, chainparams.GetConsensus(), Consensus::DEPLOYMENT_SEGSIGNAL, versionbitscache) == THRESHOLD_LOCKED_IN) &&
5187
!IsWitnessLockedIn(pindex->pprev, chainparams.GetConsensus()) && // Segwit is not locked in
5288
!IsWitnessEnabled(pindex->pprev, chainparams.GetConsensus()) ) // and is not active.
5389
{

0 commit comments

Comments
 (0)