fix `makeBeaconBlockForHeadAndSlot` for merge (#2934)

This fixes an if-else structure that was not aware of the merge phase in
`makeBeaconBlockForHeadAndSlot`, avoiding a potential crash.
This commit is contained in:
Etan Kissling 2021-09-30 18:27:17 +02:00 committed by GitHub
parent 9ee6c3e7ef
commit ba84a55699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -452,13 +452,15 @@ proc makeBeaconBlockForHeadAndSlot*(node: BeaconNode,
restore,
cache)
let doPhase0 = slot.epoch < node.dag.cfg.ALTAIR_FORK_EPOCH
return if doPhase0:
return if slot.epoch < node.dag.cfg.ALTAIR_FORK_EPOCH:
let sync_aggregate = SyncAggregate.init()
makeBeaconBlock(phase0)
else:
elif slot.epoch < node.dag.cfg.MERGE_FORK_EPOCH:
let sync_aggregate = node.sync_committee_msg_pool[].produceSyncAggregate(head.root)
makeBeaconBlock(altair)
else:
let sync_aggregate = node.sync_committee_msg_pool[].produceSyncAggregate(head.root)
makeBeaconBlock(merge)
proc proposeSignedBlock*(node: BeaconNode,
head: BlockRef,