From 83d5104cc9430d20375ec1ef4cbe568f6919e5f0 Mon Sep 17 00:00:00 2001 From: Diego Nava Date: Wed, 27 Sep 2023 15:22:38 +0200 Subject: [PATCH] flush the db every export and verify --- core/preimages.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/preimages.go b/core/preimages.go index 4f11cb655..e3f97d456 100644 --- a/core/preimages.go +++ b/core/preimages.go @@ -88,6 +88,9 @@ func ImportPreimages(chain BlockChain, path string) error { // ExportPreimages is public so `main.go` can call it directly` func ExportPreimages(chain BlockChain, path string) error { + if err := chain.CommitPreimages(); err != nil { + return fmt.Errorf("unable to commit preimages: %w", err) + } // set up csv writer, err := os.Create(path) if err != nil { @@ -310,6 +313,11 @@ func VerifyPreimages(header *block.Header, chain BlockChain) (uint64, error) { if err != nil { return 0, err } + + if err := chain.CommitPreimages(); err != nil { + return 0, fmt.Errorf("unable to commit preimages: %w", err) + } + diskDB := db.Database().DiskDB() // start the iteration accountIterator := trie.NodeIterator(nil)