From 8042c83333759061b5af0520ae7f25d96f8ffbab Mon Sep 17 00:00:00 2001 From: mk0walsk Date: Fri, 15 May 2026 22:18:24 +0800 Subject: [PATCH] core/state/pruner: handle batch write errors in pruning --- core/state/pruner/pruner.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 11f3963a3e..815f419025 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -171,7 +171,10 @@ func prune(snaptree *snapshot.Tree, root common.Hash, maindb ethdb.Database, sta // Recreate the iterator after every batch commit in order // to allow the underlying compactor to delete the entries. if batch.ValueSize() >= ethdb.IdealBatchSize { - batch.Write() + if err := batch.Write(); err != nil { + iter.Release() + return err + } batch.Reset() iter.Release() @@ -180,7 +183,10 @@ func prune(snaptree *snapshot.Tree, root common.Hash, maindb ethdb.Database, sta } } if batch.ValueSize() > 0 { - batch.Write() + if err := batch.Write(); err != nil { + iter.Release() + return err + } batch.Reset() } iter.Release()