flush the db every export and verify

pull/4513/head
Diego Nava 1 year ago
parent 8335523ac7
commit 83d5104cc9
No known key found for this signature in database
GPG Key ID: 61AFC8738DA8B8B1
  1. 8
      core/preimages.go

@ -88,6 +88,9 @@ func ImportPreimages(chain BlockChain, path string) error {
// ExportPreimages is public so `main.go` can call it directly` // ExportPreimages is public so `main.go` can call it directly`
func ExportPreimages(chain BlockChain, path string) error { 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 // set up csv
writer, err := os.Create(path) writer, err := os.Create(path)
if err != nil { if err != nil {
@ -310,6 +313,11 @@ func VerifyPreimages(header *block.Header, chain BlockChain) (uint64, error) {
if err != nil { if err != nil {
return 0, err return 0, err
} }
if err := chain.CommitPreimages(); err != nil {
return 0, fmt.Errorf("unable to commit preimages: %w", err)
}
diskDB := db.Database().DiskDB() diskDB := db.Database().DiskDB()
// start the iteration // start the iteration
accountIterator := trie.NodeIterator(nil) accountIterator := trie.NodeIterator(nil)

Loading…
Cancel
Save