From 8a8a54fe38da61de5c27c3dbe33ab982c329c317 Mon Sep 17 00:00:00 2001 From: "Leo Zhang (zhangchiqing)" Date: Fri, 12 Apr 2024 11:39:56 -0700 Subject: [PATCH] fix traversal error handling --- state/fork/traversal.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/state/fork/traversal.go b/state/fork/traversal.go index 18fdcdcbc36..e031cb8fd31 100644 --- a/state/fork/traversal.go +++ b/state/fork/traversal.go @@ -107,9 +107,11 @@ func unsafeTraverse(headers storage.Headers, block *flow.Header, visitor onVisit return block, nil } - block, err = headers.ByBlockID(block.ParentID) + parent, err := headers.ByBlockID(block.ParentID) if err != nil { return nil, fmt.Errorf("failed to revtrieve block header %x: %w", block.ParentID, err) } + + block = parent } }