Skip to content

Commit

Permalink
Fix heimdall incorrect sync data bug (#8174)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyAkhunov authored Sep 11, 2023
1 parent 787e3a0 commit dd3e628
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions eth/stagedsync/stage_bor_heimdall.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ func BorHeimdallForward(
if err != nil {
return fmt.Errorf("getting headers progress: %w", err)
}

header, err = cfg.blockReader.HeaderByNumber(ctx, tx, headNumber)

if err != nil {
return err
}
}

if s.BlockNumber == headNumber {
Expand Down Expand Up @@ -129,6 +123,12 @@ func BorHeimdallForward(
}
for blockNum := lastBlockNum + 1; blockNum <= headNumber; blockNum++ {
if blockNum%cfg.chainConfig.Bor.CalculateSprint(blockNum) == 0 {
if !mine {
header, err = cfg.blockReader.HeaderByNumber(ctx, tx, blockNum)
if err != nil {
return err
}
}
if lastEventId, err = fetchAndWriteBorEvents(ctx, cfg.blockReader, cfg.chainConfig.Bor, header, lastEventId, cfg.chainConfig.ChainID.String(), tx, cfg.heimdallClient, cfg.stateReceiverABI, s.LogPrefix(), logger); err != nil {
return err
}
Expand Down

0 comments on commit dd3e628

Please sign in to comment.