add support for validator code prefix in snapshot

feature/state_pruning_codes
“GheisMohammadi” 9 months ago
parent 51d2a00d24
commit d2edbac21e
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 6
      core/state/snapshot/conversion.go

@ -77,11 +77,17 @@ func GenerateTrie(snaptree *Tree, root common.Hash, src ethdb.Database, dst ethd
// Migrate the code first, commit the contract code into the tmp db.
if codeHash != types.EmptyCodeHash {
code := rawdb.ReadCode(src, codeHash)
if len(code) == 0 {
code = rawdb.ReadValidatorCode(src, codeHash)
if len(code) == 0 {
return common.Hash{}, errors.New("failed to read code")
} else {
rawdb.WriteValidatorCode(dst, codeHash, code)
}
} else {
rawdb.WriteCode(dst, codeHash, code)
}
}
// Then migrate all storage trie nodes into the tmp db.
storageIt, err := snaptree.StorageIterator(root, accountHash, common.Hash{})
if err != nil {

Loading…
Cancel
Save