Merge pull request #3142 from fjl/trie-sync-fix
trie: fix regression that linked all downloaded nodes together
This commit is contained in:
commit
b19b7c39ac
@ -213,11 +213,13 @@ func (s *TrieSync) children(req *request) ([]*request, error) {
|
|||||||
|
|
||||||
switch node := (*req.object).(type) {
|
switch node := (*req.object).(type) {
|
||||||
case *shortNode:
|
case *shortNode:
|
||||||
|
node = node.copy() // Prevents linking all downloaded nodes together.
|
||||||
children = []child{{
|
children = []child{{
|
||||||
node: &node.Val,
|
node: &node.Val,
|
||||||
depth: req.depth + len(node.Key),
|
depth: req.depth + len(node.Key),
|
||||||
}}
|
}}
|
||||||
case *fullNode:
|
case *fullNode:
|
||||||
|
node = node.copy()
|
||||||
for i := 0; i < 17; i++ {
|
for i := 0; i < 17; i++ {
|
||||||
if node.Children[i] != nil {
|
if node.Children[i] != nil {
|
||||||
children = append(children, child{
|
children = append(children, child{
|
||||||
|
Loading…
Reference in New Issue
Block a user