From 08379b553303586dcd6fff704776bb61ea8746db Mon Sep 17 00:00:00 2001
From: Evolution404 <35091674+Evolution404@users.noreply.github.com>
Date: Mon, 7 Jun 2021 15:11:07 +0800
Subject: [PATCH] trie: remove the duplicate batch-write for 'preimage'
 (#23001)

---
 trie/database.go | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/trie/database.go b/trie/database.go
index b18665770..f140a5664 100644
--- a/trie/database.go
+++ b/trie/database.go
@@ -703,12 +703,6 @@ func (db *Database) Commit(node common.Hash, report bool, callback func(common.H
 	// Move all of the accumulated preimages into a write batch
 	if db.preimages != nil {
 		rawdb.WritePreimages(batch, db.preimages)
-		if batch.ValueSize() > ethdb.IdealBatchSize {
-			if err := batch.Write(); err != nil {
-				return err
-			}
-			batch.Reset()
-		}
 		// Since we're going to replay trie node writes into the clean cache, flush out
 		// any batched pre-images before continuing.
 		if err := batch.Write(); err != nil {
-- 
GitLab