mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 06:46:10 +00:00
clean up quarantine
This commit is contained in:
parent
983d931a83
commit
deaeb62de3
@ -40,16 +40,16 @@ func checkMissing*(quarantine: var QuarantineRef): seq[FetchRecord] =
|
|||||||
if countOnes(v.tries.uint64) == 1:
|
if countOnes(v.tries.uint64) == 1:
|
||||||
result.add(FetchRecord(root: k))
|
result.add(FetchRecord(root: k))
|
||||||
|
|
||||||
func addMissing*(quarantine: var QuarantineRef, broot: Eth2Digest) {.inline.} =
|
func addMissing*(quarantine: var QuarantineRef, root: Eth2Digest) =
|
||||||
if broot notin quarantine.orphans:
|
## Schedule the download a the given block
|
||||||
discard quarantine.missing.hasKeyOrPut(broot, MissingBlock())
|
if root notin quarantine.orphans:
|
||||||
|
# If the block is in orphans, we no longer need it
|
||||||
|
discard quarantine.missing.hasKeyOrPut(root, MissingBlock())
|
||||||
|
|
||||||
func add*(quarantine: var QuarantineRef, dag: ChainDAGRef,
|
func add*(quarantine: var QuarantineRef, dag: ChainDAGRef,
|
||||||
sblck: SignedBeaconBlock) =
|
signedBlock: SignedBeaconBlock) =
|
||||||
## Adds block to quarantine's `orphans` and `missing` lists.
|
## Adds block to quarantine's `orphans` and `missing` lists.
|
||||||
quarantine.orphans[sblck.root] = sblck
|
quarantine.orphans[signedBlock.root] = signedBlock
|
||||||
quarantine.missing.del(sblck.root)
|
quarantine.missing.del(signedBlock.root)
|
||||||
|
|
||||||
let parentRoot = sblck.message.parent_root
|
quarantine.addMissing(signedBlock.message.parent_root)
|
||||||
if parentRoot notin quarantine.orphans:
|
|
||||||
quarantine.addMissing(parentRoot)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user