Introduce AuxPoW chain parameters

Introduce AuxPoW chain parameters. These are not yet used, splitting these out to make validation easier.
This commit is contained in:
Ross Nicoll 2021-06-05 09:09:47 +01:00
parent b7413c2f50
commit 140871623d
No known key found for this signature in database
GPG Key ID: E679E30C312B94E0
2 changed files with 33 additions and 0 deletions

View File

@ -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;

View File

@ -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<int> (nHeight) < nLegacyBlocksBefore;
}
};
} // namespace Consensus