fix best LC updates when backfilling (#4195)

When backfilling LC updates (`--light-client-data-import-mode=full`),
the highest participation update is computed without ensuring that the
finalized header is in the same period. Updates sharing same period for
both finalized and attested headers should be preferred.
Fixes a bug leading to suboptimal update selection.
This commit is contained in:
Etan Kissling 2022-09-29 07:55:04 +02:00 committed by GitHub
parent c1fe81d2ec
commit c9f69fc38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -305,9 +305,7 @@ proc initLightClientUpdateForPeriod(
if signatureBid.slot == FAR_FUTURE_SLOT:
signatureBid = maxParticipantsBid
else:
let
nextLowSlot = signatureBid.slot + 1
signatureRes = dag.maxParticipantsBlock(highBid, nextLowSlot)
let signatureRes = dag.maxParticipantsBlock(highBid, signatureBid.slot)
if signatureRes.res.isErr:
res.err()
signatureBid = signatureRes.bid.valueOr:
@ -337,7 +335,7 @@ proc initLightClientUpdateForPeriod(
continue
else:
continue
if finalizedBid.slot >= lowSlot:
if finalizedBsi.bid.slot >= lowSlot:
finalizedBid = finalizedBsi.bid
break
if signatureBid == maxParticipantsBid: