keep unviables in quarantine (#3331)

they remain unviable even after a reorg
This commit is contained in:
Jacek Sieka 2022-01-28 11:59:55 +01:00 committed by GitHub
parent 49b7daa39d
commit e264276b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -171,8 +171,11 @@ func cleanupOrphans(quarantine: var Quarantine, finalizedSlot: Slot) =
for k in toDel:
quarantine.addUnviable k[0]
func clearQuarantine*(quarantine: var Quarantine) =
quarantine = Quarantine()
func clearAfterReorg*(quarantine: var Quarantine) =
## Clear missing and orphans to start with a fresh slate in case of a reorg
## Unviables remain unviable and are not cleared.
quarantine.missing.reset()
quarantine.orphans.reset()
# Typically, blocks will arrive in mostly topological order, with some
# out-of-order block pairs. Therefore, it is unhelpful to use either a

View File

@ -1344,7 +1344,8 @@ proc updateHead*(
dag.onReorgHappened(data)
# A reasonable criterion for "reorganizations of the chain"
quarantine.clearQuarantine()
quarantine.clearAfterReorg()
beacon_reorgs_total_total.inc()
beacon_reorgs_total.inc()
else:
@ -1510,9 +1511,6 @@ proc preInit*(
tailBlock: ForkedTrustedSignedBeaconBlock) =
# write a genesis state, the way the ChainDAGRef expects it to be stored in
# database
# TODO probably should just init a block pool with the freshly written
# state - but there's more refactoring needed to make it nice - doing
# a minimal patch for now..
logScope:
genesisStateRoot = getStateRoot(genesisState)