Skip to content

Commit

Permalink
fix: check oneBlocksAboveLibRef arrays length and throw error if length
Browse files Browse the repository at this point in the history
is 0, fixes issue streamingfast#38
  • Loading branch information
ring0-rootkit committed Jan 30, 2025
1 parent 5539724 commit 1efa5a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hub/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ func (h *ForkableHub) bootstrap() error {
}
}

if len(oneBlocksAboveLibRef) == 0 {
return fmt.Errorf("no one blocks above libRef found")
}

if !h.forkable.Linkable(oneBlocksAboveLibRef[len(oneBlocksAboveLibRef)-1]) {
return fmt.Errorf("most recent one block is not linkable")
}
Expand Down

0 comments on commit 1efa5a3

Please sign in to comment.