Merge #1185: Trigger removel changes
- Do not expire superblock triggers on execution - Expire trigger objects about 1 day (576 blocks) after their event height is past
This commit is contained in:
parent
bc3b349cc1
commit
8126e92441
@ -204,24 +204,13 @@ void CGovernanceTriggerManager::CleanAndRemove()
|
||||
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- Unknown or invalid trigger found\n");
|
||||
remove = true;
|
||||
break;
|
||||
case SEEN_OBJECT_EXECUTED:
|
||||
{
|
||||
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- Executed trigger found\n");
|
||||
CGovernanceObject* pgovobj = pSuperblock->GetGovernanceObject();
|
||||
if(pgovobj) {
|
||||
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- Expiring executed object: %s\n", pgovobj->GetHash().ToString());
|
||||
pgovobj->fExpired = true;
|
||||
pgovobj->nDeletionTime = GetAdjustedTime();
|
||||
}
|
||||
}
|
||||
remove = true;
|
||||
break;
|
||||
case SEEN_OBJECT_IS_VALID:
|
||||
case SEEN_OBJECT_EXECUTED:
|
||||
{
|
||||
int nTriggerBlock = pSuperblock->GetBlockStart();
|
||||
// Rough approximation: a cycle of superblock ++
|
||||
int nExpirationBlock = nTriggerBlock + Params().GetConsensus().nSuperblockCycle + GOVERNANCE_FEE_CONFIRMATIONS;
|
||||
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- nTriggerBlock = %d, nExpriartionBlock = %d\n");
|
||||
int nExpirationBlock = nTriggerBlock + GOVERNANCE_TRIGGER_EXPIRATION_BLOCKS;
|
||||
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- nTriggerBlock = %d, nExpirationBlock = %d\n", nTriggerBlock, nExpirationBlock);
|
||||
if(governance.GetCachedBlockHeight() > nExpirationBlock) {
|
||||
LogPrint("gobject", "CGovernanceTriggerManager::CleanAndRemove -- Outdated trigger found\n");
|
||||
remove = true;
|
||||
@ -459,7 +448,6 @@ void CSuperblockManager::CreateSuperblock(CMutableTransaction& txNewRet, int nBl
|
||||
DBG( cout << "CSuperblockManager::CreateSuperblock Before LogPrintf call, nAmount = " << payment.nAmount << endl; );
|
||||
LogPrintf("NEW Superblock : output %d (addr %s, amount %d)\n", i, address2.ToString(), payment.nAmount);
|
||||
DBG( cout << "CSuperblockManager::CreateSuperblock After LogPrintf call " << endl; );
|
||||
pSuperblock->SetExecuted();
|
||||
} else {
|
||||
DBG( cout << "CSuperblockManager::CreateSuperblock Payment not found " << endl; );
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ static const int64_t GOVERNANCE_DELETION_DELAY = 10*60;
|
||||
static const int64_t GOVERNANCE_ORPHAN_EXPIRATION_TIME = 10*60;
|
||||
static const int64_t GOVERNANCE_WATCHDOG_EXPIRATION_TIME = 2*60*60;
|
||||
|
||||
static const int GOVERNANCE_TRIGGER_EXPIRATION_BLOCKS = 576;
|
||||
|
||||
// FOR SEEN MAP ARRAYS - GOVERNANCE OBJECTS AND VOTES
|
||||
static const int SEEN_OBJECT_IS_VALID = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user