From 140871623d521050eb84e5aed986387590cce2ca Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Sat, 5 Jun 2021 09:09:47 +0100 Subject: [PATCH] Introduce AuxPoW chain parameters Introduce AuxPoW chain parameters. These are not yet used, splitting these out to make validation easier. --- src/chainparams.cpp | 16 ++++++++++++++++ src/consensus/params.h | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index dd3e4a5a7..4a5546a5e 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -99,6 +99,10 @@ public: consensus.fSimplifiedRewards = false; consensus.fShortEarlyCoinbase = true; + consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise! + consensus.fStrictChainId = true; + consensus.nLegacyBlocksBefore = 371337; + /** * The message start string is designed to be unlikely to occur in normal data. * The characters are rarely used upper ASCII, not valid as UTF-8, and produce @@ -216,6 +220,10 @@ public: consensus.fSimplifiedRewards = false; consensus.fShortEarlyCoinbase = true; + consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise! + consensus.fStrictChainId = false; + consensus.nLegacyBlocksBefore = 158100; + pchMessageStart[0] = 0xfc; pchMessageStart[1] = 0xc1; pchMessageStart[2] = 0xb7; @@ -345,6 +353,10 @@ public: consensus.fSimplifiedRewards = true; consensus.fShortEarlyCoinbase = true; + consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise! + consensus.fStrictChainId = true; + consensus.nLegacyBlocksBefore = 0; + // message start is defined as the first 4 bytes of the sha256d of the block script CHashWriter h(SER_DISK, 0); h << consensus.signet_challenge; @@ -417,6 +429,10 @@ public: consensus.fSimplifiedRewards = true; consensus.fShortEarlyCoinbase = false; + consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise! + consensus.fStrictChainId = true; + consensus.nLegacyBlocksBefore = 0; + pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xbf; pchMessageStart[2] = 0xb5; diff --git a/src/consensus/params.h b/src/consensus/params.h index b7223b2fc..baf841e33 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -95,6 +95,23 @@ struct Params { bool fSimplifiedRewards; bool fShortEarlyCoinbase; + + /** Auxpow parameters */ + int32_t nAuxpowChainId; + bool fStrictChainId; + int nLegacyBlocksBefore; // -1 for "always allow" + + /** + * Check whether or not to allow legacy blocks at the given height. + * @param nHeight Height of the block to check. + * @return True if it is allowed to have a legacy version. + */ + bool AllowLegacyBlocks(unsigned nHeight) const + { + if (nLegacyBlocksBefore < 0) + return true; + return static_cast (nHeight) < nLegacyBlocksBefore; + } }; } // namespace Consensus