Skip to content

Commit

Permalink
[Core] define Block version 7 removing the accumulator checkpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Nov 22, 2019
1 parent 750d04f commit 9cf6c69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet,
const int nHeight = pindexPrev->nHeight + 1;

// Make sure to create the correct block version after zerocoin is enabled
bool fZerocoinActive = nHeight >= Params().Zerocoin_StartHeight();
if(Params().IsStakeModifierV2(nHeight)) {
pblock->nVersion = 6; //!> Supports V2 Stake Modifiers.
if(nHeight >= Params().Block_V7_StartHeight()) {
pblock->nVersion = 7; //!> Removes accumulator checkpoints
} else {
pblock->nVersion = 5; //!> Supports CLTV activation
pblock->nVersion = 6; //!> Supports V2 Stake Modifiers.
}

// -regtest only: allow overriding block.nVersion with
// -blockversion=N to test forking scenarios
bool fZerocoinActive = nHeight >= Params().Zerocoin_StartHeight();
if (Params().MineBlocksOnDemand()) {
if (fZerocoinActive)
pblock->nVersion = 5;
Expand Down
6 changes: 3 additions & 3 deletions src/primitives/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class CBlockHeader
{
public:
// header
static const int32_t CURRENT_VERSION=6; //!> Version 6 supports V2 Stake Modifiers
static const int32_t CURRENT_VERSION=7; //!> Version 7 removes nAccumulatorCheckpoint from serialization
int32_t nVersion;
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
uint32_t nTime;
uint32_t nBits;
uint32_t nNonce;
uint256 nAccumulatorCheckpoint;
uint256 nAccumulatorCheckpoint; // only for version 4, 5 and 6.

CBlockHeader()
{
Expand All @@ -54,7 +54,7 @@ class CBlockHeader
READWRITE(nNonce);

//zerocoin active, header changes to include accumulator checksum
if(nVersion > 3)
if(nVersion > 3 && nVersion < 7)
READWRITE(nAccumulatorCheckpoint);
}

Expand Down

0 comments on commit 9cf6c69

Please sign in to comment.