Skip to content

Commit

Permalink
Fix indefinite loop when when validators are present, but VC does not…
Browse files Browse the repository at this point in the history
… know indices yet.

Fix block pruning when no validators seen.
  • Loading branch information
cheatfate committed Oct 8, 2024
1 parent 7990cc2 commit 76cf5e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions beacon_chain/validator_client/duties_service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ proc pollForAttesterDuties*(service: DutiesServiceRef,
vc = service.client
indices = toSeq(vc.attachedValidators[].indices())
relevantDuties =
block:
if len(indices) > 0:
var duties: seq[RestAttesterDuty]
block mainLoop:
while true:
Expand Down Expand Up @@ -153,6 +153,8 @@ proc pollForAttesterDuties*(service: DutiesServiceRef,
duties.add(duty)
break mainLoop
duties
else:
default(seq[RestAttesterDuty])

template checkReorg(a, b: untyped): bool =
not(a.dependentRoot == b.get())
Expand Down Expand Up @@ -518,8 +520,8 @@ proc pollForBeaconProposers*(service: DutiesServiceRef) {.async.} =
slot = currentSlot, epoch = currentEpoch, err_name = exc.name,
err_msg = exc.msg

service.pruneBeaconProposers(currentEpoch)
vc.pruneBlocksSeen(currentEpoch)
service.pruneBeaconProposers(currentEpoch)
vc.pruneBlocksSeen(currentEpoch)

proc prepareBeaconProposers*(service: DutiesServiceRef) {.async.} =
let vc = service.client
Expand Down

0 comments on commit 76cf5e9

Please sign in to comment.