Fix Governance Object's Expiration calculation. (#1109)

Use nSuperblockCycle instead of "blocks monthly" approximation
This commit is contained in:
TheLazieR Yip 2016-10-31 02:36:52 +07:00 committed by UdjinM6
parent 1a81c341bc
commit 740fcce6a4

View File

@ -211,10 +211,9 @@ void CGovernanceTriggerManager::CleanAndRemove()
break; break;
case SEEN_OBJECT_IS_VALID: case SEEN_OBJECT_IS_VALID:
{ {
// Rough approximation: 30 days per month * 576 blocks per day
static const int nMonthlyBlocks = 30*576;
int nTriggerBlock = pSuperblock->GetBlockStart(); int nTriggerBlock = pSuperblock->GetBlockStart();
int nExpirationBlock = nTriggerBlock + nMonthlyBlocks; // Rough approximation: a cycle of superblock ++
int nExpirationBlock = nTriggerBlock + Params().GetConsensus().nSuperblockCycle + GOVERNANCE_FEE_CONFIRMATIONS;
if(governance.GetCachedBlockHeight() > nExpirationBlock) { if(governance.GetCachedBlockHeight() > nExpirationBlock) {
remove = true; remove = true;
CGovernanceObject* pgovobj = pSuperblock->GetGovernanceObject(); CGovernanceObject* pgovobj = pSuperblock->GetGovernanceObject();