lear missing on orphan add in quarantine (#1441)

This commit is contained in:
Jacek Sieka 2020-08-04 21:49:25 +02:00 committed by GitHub
parent 70df0ad057
commit ac78e75bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -41,12 +41,14 @@ func checkMissing*(quarantine: var QuarantineRef): seq[FetchRecord] =
result.add(FetchRecord(root: k)) result.add(FetchRecord(root: k))
func addMissing*(quarantine: var QuarantineRef, broot: Eth2Digest) {.inline.} = func addMissing*(quarantine: var QuarantineRef, broot: Eth2Digest) {.inline.} =
if broot notin quarantine.orphans:
discard quarantine.missing.hasKeyOrPut(broot, MissingBlock()) discard quarantine.missing.hasKeyOrPut(broot, MissingBlock())
func add*(quarantine: var QuarantineRef, dag: ChainDAGRef, func add*(quarantine: var QuarantineRef, dag: ChainDAGRef,
sblck: SignedBeaconBlock) = sblck: 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[sblck.root] = sblck
quarantine.missing.del(sblck.root)
let parentRoot = sblck.message.parent_root let parentRoot = sblck.message.parent_root
if parentRoot notin quarantine.orphans: if parentRoot notin quarantine.orphans: