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

Clarify break on error during ancestors lookup #1580

Merged
merged 7 commits into from
Jun 7, 2023
Merged
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion snow/engine/snowman/block/batched_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func GetAncestors(
startTime := time.Now()
blk, err := vm.GetBlock(ctx, blkID)
if err == database.ErrNotFound {
// special case ErrNotFound as an empty response: this signals
// Special case ErrNotFound as an empty response: this signals
// the client to avoid contacting this node for further ancestors
// as they may have been pruned or unavailable due to state-sync.
return nil, nil
Expand All @@ -76,6 +76,7 @@ func GetAncestors(
for numFetched := 1; numFetched < maxBlocksNum && time.Since(startTime) < maxBlocksRetrivalTime; numFetched++ {
blk, err = vm.GetBlock(ctx, blk.Parent())
hexfusion marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
hexfusion marked this conversation as resolved.
Show resolved Hide resolved
// After state sync we may not have the full chain
hexfusion marked this conversation as resolved.
Show resolved Hide resolved
break
}
blkBytes := blk.Bytes()
Expand Down