Skip to content

Commit

Permalink
fix: bail early on empty block before sending event (#331)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
  • Loading branch information
wolf31o2 authored Feb 4, 2025
1 parent e2ba332 commit 09c8e18
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions input/chainsync/chainsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ func (c *ChainSync) handleRollForward(
if err != nil {
return err
}
if block == nil {
return fmt.Errorf("blockfetch returned empty")
}
blockEvt := event.New("chainsync.block", time.Now(), NewBlockHeaderContext(v), NewBlockEvent(block, c.includeCbor))
c.eventChan <- blockEvt
for t, transaction := range block.Transactions() {
Expand Down

0 comments on commit 09c8e18

Please sign in to comment.