cmd/era: fix iterator error source handling in checkAccumulator

This commit is contained in:
MozirDmitriy 2025-09-22 10:09:57 +03:00 committed by GitHub
parent aa37bd063d
commit d367576093
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -273,11 +273,11 @@ func checkAccumulator(e *era.Era) error {
// accumulation across the entire set and are verified at the end. // accumulation across the entire set and are verified at the end.
for it.Next() { for it.Next() {
// 1) next() walks the block index, so we're able to implicitly verify it. // 1) next() walks the block index, so we're able to implicitly verify it.
if it.Error() != nil { if itErr := it.Error(); itErr != nil {
return fmt.Errorf("error reading block %d: %w", it.Number(), err) return fmt.Errorf("error reading block %d: %w", it.Number(), itErr)
} }
block, receipts, err := it.BlockAndReceipts() block, receipts, err := it.BlockAndReceipts()
if it.Error() != nil { if err != nil {
return fmt.Errorf("error reading block %d: %w", it.Number(), err) return fmt.Errorf("error reading block %d: %w", it.Number(), err)
} }
// 2) recompute tx root and verify against header. // 2) recompute tx root and verify against header.