aboutsummaryrefslogtreecommitdiffstats
path: root/trie/sync.go
diff options
context:
space:
mode:
Diffstat (limited to 'trie/sync.go')
-rw-r--r--trie/sync.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/trie/sync.go b/trie/sync.go
index d55399d06..a35478f83 100644
--- a/trie/sync.go
+++ b/trie/sync.go
@@ -75,8 +75,9 @@ func (s *TrieSync) AddSubTrie(root common.Hash, depth int, parent common.Hash, c
if root == emptyRoot {
return
}
- blob, _ := s.database.Get(root.Bytes())
- if local, err := decodeNode(blob); local != nil && err == nil {
+ key := root.Bytes()
+ blob, _ := s.database.Get(key)
+ if local, err := decodeNode(key, blob); local != nil && err == nil {
return
}
// Assemble the new sub-trie sync request
@@ -152,7 +153,7 @@ func (s *TrieSync) Process(results []SyncResult) (int, error) {
continue
}
// Decode the node data content and update the request
- node, err := decodeNode(item.Data)
+ node, err := decodeNode(item.Hash[:], item.Data)
if err != nil {
return i, err
}
@@ -213,9 +214,9 @@ func (s *TrieSync) children(req *request) ([]*request, error) {
}}
case fullNode:
for i := 0; i < 17; i++ {
- if node[i] != nil {
+ if node.Children[i] != nil {
children = append(children, child{
- node: &node[i],
+ node: &node.Children[i],
depth: req.depth + 1,
})
}
@@ -238,7 +239,7 @@ func (s *TrieSync) children(req *request) ([]*request, error) {
if node, ok := (*child.node).(hashNode); ok {
// Try to resolve the node from the local database
blob, _ := s.database.Get(node)
- if local, err := decodeNode(blob); local != nil && err == nil {
+ if local, err := decodeNode(node[:], blob); local != nil && err == nil {
*child.node = local
continue
}