|
|
@ -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) |
|
|
|