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. 10
      core/state/snapshot/conversion.go

@ -78,9 +78,15 @@ func GenerateTrie(snaptree *Tree, root common.Hash, src ethdb.Database, dst ethd
if codeHash != types.EmptyCodeHash { if codeHash != types.EmptyCodeHash {
code := rawdb.ReadCode(src, codeHash) code := rawdb.ReadCode(src, codeHash)
if len(code) == 0 { if len(code) == 0 {
return common.Hash{}, errors.New("failed to read code") 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)
} }
rawdb.WriteCode(dst, codeHash, code)
} }
// Then migrate all storage trie nodes into the tmp db. // Then migrate all storage trie nodes into the tmp db.
storageIt, err := snaptree.StorageIterator(root, accountHash, common.Hash{}) storageIt, err := snaptree.StorageIterator(root, accountHash, common.Hash{})

Loading…
Cancel
Save