mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
put some reasonable limits on SPORK_12_RECONSIDER_BLOCKS (#1312)
* put some reasonable limits on SPORK_12_RECONSIDER_BLOCKS * 6h -> 24h
This commit is contained in:
parent
636e48b2a8
commit
8c6f756362
@ -75,9 +75,28 @@ void CSporkManager::ExecuteSpork(int nSporkID, int nValue)
|
|||||||
{
|
{
|
||||||
//correct fork via spork technology
|
//correct fork via spork technology
|
||||||
if(nSporkID == SPORK_12_RECONSIDER_BLOCKS && nValue > 0) {
|
if(nSporkID == SPORK_12_RECONSIDER_BLOCKS && nValue > 0) {
|
||||||
|
// allow to reprocess 24h of blocks max, which should be enough to resolve any issues
|
||||||
|
int64_t nMaxBlocks = 576;
|
||||||
|
// this potentially can be a heavy operation, so only allow this to be executed once per 10 minutes
|
||||||
|
int64_t nTimeout = 10 * 60;
|
||||||
|
|
||||||
|
static int64_t nTimeExecuted = 0; // i.e. it was never executed before
|
||||||
|
|
||||||
|
if(GetTime() - nTimeExecuted < nTimeout) {
|
||||||
|
LogPrint("spork", "CSporkManager::ExecuteSpork -- ERROR: Trying to reconsider blocks, too soon - %d/%d\n", GetTime() - nTimeExecuted, nTimeout);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nValue > nMaxBlocks) {
|
||||||
|
LogPrintf("CSporkManager::ExecuteSpork -- ERROR: Trying to reconsider too many blocks %d/%d\n", nValue, nMaxBlocks);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LogPrintf("CSporkManager::ExecuteSpork -- Reconsider Last %d Blocks\n", nValue);
|
LogPrintf("CSporkManager::ExecuteSpork -- Reconsider Last %d Blocks\n", nValue);
|
||||||
|
|
||||||
ReprocessBlocks(nValue);
|
ReprocessBlocks(nValue);
|
||||||
|
nTimeExecuted = GetTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user