Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check oneBlocksAboveLibRef arrays length and throw error if length is 0 #39

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: check oneBlocksAboveLibRef arrays length and throw error if length
is 0, fixes issue #38
ring0-rootkit committed Jan 30, 2025
commit 1efa5a3fbf6e0b6a079499bac4a4260c19d8fd56
4 changes: 4 additions & 0 deletions hub/hub.go
Original file line number Diff line number Diff line change
@@ -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")
}