From cebc3312f34e6f11bfb250fefe3a2fd514593e96 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Fri, 15 Nov 2024 09:44:31 +0800 Subject: [PATCH] core/state/snapshot: check it.fail error --- core/state/snapshot/iterator_binary.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/state/snapshot/iterator_binary.go b/core/state/snapshot/iterator_binary.go index 41d96be429..523c7b9946 100644 --- a/core/state/snapshot/iterator_binary.go +++ b/core/state/snapshot/iterator_binary.go @@ -121,10 +121,14 @@ func (it *binaryIterator) Next() bool { if !it.next() { return false } - if len(it.Account()) == 0 && len(it.Slot()) == 0 { - continue + if len(it.Account()) != 0 || len(it.Slot()) != 0 { + return true + } + // it.fail might be set if error occurs by calling + // it.Account() or it.Slot(), stop iteration if so. + if it.fail != nil { + return false } - return true } }