From 55890a05430c2ec3a500d71b2a983918c1312ac3 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 11 Jul 2020 01:19:08 -0400 Subject: [PATCH] Set various chain params when changing blocktime --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index ea7fa7a1f..00d470573 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3234,6 +3234,8 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex if (ishush3 && (ASSETCHAINS_BLOCKTIME != 150) && (nHeight < nFirstHalvingHeight)) { LogPrintf("%s: Setting blocktime to 150s at height %d!\n",__func__,nHeight); ASSETCHAINS_BLOCKTIME = 150; + Params.GetConsensus().nMaxFutureBlockTime = 7 * ASSETCHAINS_BLOCKTIME; + Params.GetConsensus().nPowTargetSpacing = ASSETCHAINS_BLOCKTIME; } @@ -3386,6 +3388,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin if (ishush3 && (ASSETCHAINS_BLOCKTIME != 75) && (chainActive.Height() >= nFirstHalvingHeight)) { LogPrintf("%s: Blocktime halving to 75s at height %d!\n",__func__,pindex->GetHeight()); ASSETCHAINS_BLOCKTIME = 75; + Params.GetConsensus().nMaxFutureBlockTime = 7 * ASSETCHAINS_BLOCKTIME; + Params.GetConsensus().nPowTargetSpacing = ASSETCHAINS_BLOCKTIME; } bool fExpensiveChecks = true; @@ -3988,6 +3992,8 @@ void static UpdateTip(CBlockIndex *pindexNew) { if (ASSETCHAINS_BLOCKTIME != 75 && (chainActive.Height() >= nFirstHalvingHeight)) { LogPrintf("%s: Blocktime halving to 75s at height %d!\n",__func__,chainActive.Height()); ASSETCHAINS_BLOCKTIME = 75; + Params.GetConsensus().nMaxFutureBlockTime = 7 * ASSETCHAINS_BLOCKTIME; + Params.GetConsensus().nPowTargetSpacing = ASSETCHAINS_BLOCKTIME; } }