|
|
@ -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.
|
|
|
|
// Migrate the code first, commit the contract code into the tmp db.
|
|
|
|
if codeHash != types.EmptyCodeHash { |
|
|
|
if codeHash != types.EmptyCodeHash { |
|
|
|
code := rawdb.ReadCode(src, codeHash) |
|
|
|
code := rawdb.ReadCode(src, codeHash) |
|
|
|
|
|
|
|
if len(code) == 0 { |
|
|
|
|
|
|
|
code = rawdb.ReadValidatorCode(src, codeHash) |
|
|
|
if len(code) == 0 { |
|
|
|
if len(code) == 0 { |
|
|
|
return common.Hash{}, errors.New("failed to read code") |
|
|
|
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{}) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|