Skip to content

Commit

Permalink
Bump automatic replay protection to May 2019 upgrade
Browse files Browse the repository at this point in the history
Summary:
This returns main chain to ForkID of 0 after the Nov 2018
upgrade, and implements automatic replay protection for
the May 2019 upgrade.

For reference see last HF:
https://reviews.bitcoinabc.org/D1199

Test Plan:
Replay protection is covered by unit tests, however
it is very important to manually double check that the timestamp
for activation is set correctly.

Reviewers: deadalnix, schancel, jasonbcox, #bitcoin_abc

Reviewed By: deadalnix, schancel, jasonbcox, #bitcoin_abc

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1612
  • Loading branch information
Mengerian committed Aug 8, 2018
1 parent fad6084 commit 92da404
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/release-notes.md
Expand Up @@ -8,3 +8,5 @@ This release includes the following features and fixes:
- Remove the rules, vbavailable and vbrequired result from the getblocktemplate RPC call.
- Remove the rules argument from the getblocktemplate RPC call.
- Log difference between block header time and received time when competing blocks are received for the same chain height.
- Bump automatic replay protection to May 2019 upgrade

9 changes: 9 additions & 0 deletions src/chainparams.cpp
Expand Up @@ -131,6 +131,9 @@ class CMainParams : public CChainParams {
// Nov 15, 2018 hard fork
consensus.magneticAnomalyActivationTime = 1542300000;

// Wed, 15 May 2019 12:00:00 UTC hard fork
consensus.greatWallActivationTime = 1557921600;

/**
* The message start string is designed to be unlikely to occur in
* normal data. The characters are rarely used upper ASCII, not valid as
Expand Down Expand Up @@ -300,6 +303,9 @@ class CTestNetParams : public CChainParams {
// Nov 15, 2018 hard fork
consensus.magneticAnomalyActivationTime = 1542300000;

// Wed, 15 May 2019 12:00:00 UTC hard fork
consensus.greatWallActivationTime = 1557921600;

diskMagic[0] = 0x0b;
diskMagic[1] = 0x11;
diskMagic[2] = 0x09;
Expand Down Expand Up @@ -423,6 +429,9 @@ class CRegTestParams : public CChainParams {
// Nov 15, 2018 hard fork
consensus.magneticAnomalyActivationTime = 1542300000;

// Wed, 15 May 2019 12:00:00 UTC hard fork
consensus.greatWallActivationTime = 1557921600;

diskMagic[0] = 0xfa;
diskMagic[1] = 0xbf;
diskMagic[2] = 0xb5;
Expand Down
2 changes: 2 additions & 0 deletions src/consensus/params.h
Expand Up @@ -56,6 +56,8 @@ struct Params {
int daaHeight;
/** Unix time used for MTP activation of Nov 15 2018, hardfork */
int magneticAnomalyActivationTime;
/** Unix time used for MTP activation of 15 May 2019 12:00:00 UTC upgrade */
int greatWallActivationTime;
/**
* Minimum blocks including miner confirmation of the total of 2016 blocks
* in a retargeting period, (nPowTargetTimespan / nPowTargetSpacing) which
Expand Down
6 changes: 5 additions & 1 deletion src/validation.cpp
Expand Up @@ -600,12 +600,16 @@ static bool IsMagneticAnomalyEnabledForCurrentBlock(const Config &config) {
return IsMagneticAnomalyEnabled(config, chainActive.Tip());
}

// Command-line argument "-replayprotectionactivationtime=<timestamp>" will
// cause the node to switch to replay protected SigHash ForkID value when the
// median timestamp of the previous 11 blocks is greater than or equal to
// <timestamp>. Defaults to the pre-defined timestamp when not set.
static bool IsReplayProtectionEnabled(const Config &config,
int64_t nMedianTimePast) {
return nMedianTimePast >= gArgs.GetArg("-replayprotectionactivationtime",
config.GetChainParams()
.GetConsensus()
.magneticAnomalyActivationTime);
.greatWallActivationTime);
}

static bool IsReplayProtectionEnabled(const Config &config,
Expand Down

0 comments on commit 92da404

Please sign in to comment.