@@ -27,29 +27,29 @@ import (
27
27
)
28
28
29
29
// NewStateSync create a new state trie download scheduler.
30
- func NewStateSync (root common.Hash , database ethdb.KeyValueReader , onLeaf func (paths [][]byte , leaf []byte ) error ) * trie.Sync {
30
+ func NewStateSync (root common.Hash , database ethdb.KeyValueReader , onLeaf func (keys [][]byte , leaf []byte ) error ) * trie.Sync {
31
31
// Register the storage slot callback if the external callback is specified.
32
- var onSlot func (paths [][]byte , hexpath []byte , leaf []byte , parent common.Hash ) error
32
+ var onSlot func (keys [][]byte , path []byte , leaf []byte , parent common.Hash , parentPath [] byte ) error
33
33
if onLeaf != nil {
34
- onSlot = func (paths [][]byte , hexpath []byte , leaf []byte , parent common.Hash ) error {
35
- return onLeaf (paths , leaf )
34
+ onSlot = func (keys [][]byte , path []byte , leaf []byte , parent common.Hash , parentPath [] byte ) error {
35
+ return onLeaf (keys , leaf )
36
36
}
37
37
}
38
38
// Register the account callback to connect the state trie and the storage
39
39
// trie belongs to the contract.
40
40
var syncer * trie.Sync
41
- onAccount := func (paths [][]byte , hexpath []byte , leaf []byte , parent common.Hash ) error {
41
+ onAccount := func (keys [][]byte , path []byte , leaf []byte , parent common.Hash , parentPath [] byte ) error {
42
42
if onLeaf != nil {
43
- if err := onLeaf (paths , leaf ); err != nil {
43
+ if err := onLeaf (keys , leaf ); err != nil {
44
44
return err
45
45
}
46
46
}
47
47
var obj types.StateAccount
48
48
if err := rlp .Decode (bytes .NewReader (leaf ), & obj ); err != nil {
49
49
return err
50
50
}
51
- syncer .AddSubTrie (obj .Root , hexpath , parent , onSlot )
52
- syncer .AddCodeEntry (common .BytesToHash (obj .CodeHash ), hexpath , parent )
51
+ syncer .AddSubTrie (obj .Root , path , parent , parentPath , onSlot )
52
+ syncer .AddCodeEntry (common .BytesToHash (obj .CodeHash ), path , parent , parentPath )
53
53
return nil
54
54
}
55
55
syncer = trie .NewSync (root , database , onAccount )
0 commit comments