Skip to content

Commit b19b7c3

Browse files
authored
Merge pull request bnb-chain#3142 from fjl/trie-sync-fix
trie: fix regression that linked all downloaded nodes together
2 parents 9276c4e + 2cd7a03 commit b19b7c3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎trie/sync.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,13 @@ func (s *TrieSync) children(req *request) ([]*request, error) {
213213

214214
switch node := (*req.object).(type) {
215215
case *shortNode:
216+
node = node.copy() // Prevents linking all downloaded nodes together.
216217
children = []child{{
217218
node: &node.Val,
218219
depth: req.depth + len(node.Key),
219220
}}
220221
case *fullNode:
222+
node = node.copy()
221223
for i := 0; i < 17; i++ {
222224
if node.Children[i] != nil {
223225
children = append(children, child{

0 commit comments

Comments
 (0)