From 5a1109ccf409e62a6044e39adf1fc55246fc0e17 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 23 Jul 2020 08:04:25 -0400 Subject: [PATCH] Allow z2z fork height to be specified on CLI for testing --- src/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index ac9be64b3..54643992f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3232,6 +3232,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex // If disconnecting a block brings us back before our blocktime halving height, go back // to our original blocktime so our DAA has the correct target for that height int nHeight = pindex->pprev->GetHeight(); + nFirstHalvingHeight = GetArg("-z2zheight",340000); if (ishush3 && (ASSETCHAINS_BLOCKTIME != 150) && (nHeight < nFirstHalvingHeight)) { LogPrintf("%s: Setting blocktime to 150s at height %d!\n",__func__,nHeight); ASSETCHAINS_BLOCKTIME = 150; @@ -3378,6 +3379,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin // At startup, HUSH3 doesn't know a block height yet and so we must wait until // connecting a block to set our private/blocktime flags, which are height-dependent + nFirstHalvingHeight = GetArg("-z2zheight",340000); if(!ASSETCHAINS_PRIVATE && ishush3) { unsigned int nHeight = pindex->GetHeight(); if(nHeight >= nFirstHalvingHeight) { @@ -3987,6 +3989,7 @@ void static UpdateTip(CBlockIndex *pindexNew) { progress = (longestchain > 0 ) ? (double) chainActive.Height() / longestchain : 1.0; } + nFirstHalvingHeight = GetArg("-z2zheight",340000); if(ishush3) { if (ASSETCHAINS_BLOCKTIME != 75 && (chainActive.Height() >= nFirstHalvingHeight)) { LogPrintf("%s: Blocktime halving to 75s at height %d!\n",__func__,chainActive.Height());