Create setter to modify blocktime consensus params at run-time
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -85,6 +85,7 @@ int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
||||
//void komodo_broadcast(CBlock *pblock,int32_t limit);
|
||||
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
||||
void komodo_setactivation(int32_t height);
|
||||
void hush_changeblocktime();
|
||||
void komodo_pricesupdate(int32_t height,CBlock *pblock);
|
||||
|
||||
BlockMap mapBlockIndex;
|
||||
@@ -3233,9 +3234,8 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
|
||||
int nHeight = pindex->pprev->GetHeight();
|
||||
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;
|
||||
ASSETCHAINS_BLOCKTIME = 150;
|
||||
hush_changeblocktime();
|
||||
}
|
||||
|
||||
|
||||
@@ -3388,8 +3388,7 @@ 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;
|
||||
hush_changeblocktime();
|
||||
}
|
||||
|
||||
bool fExpensiveChecks = true;
|
||||
@@ -3992,8 +3991,7 @@ 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;
|
||||
hush_changeblocktime();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user