core: try to collapse traversed Billet part on errStop

This commit is contained in:
Anna Shaleva 2021-10-13 13:48:18 +03:00
parent 360bb220b0
commit 495aba4174

View file

@ -258,7 +258,7 @@ func (b *Billet) traverse(curr Node, path, from []byte, process func(pathToNode
return nil, err return nil, err
} }
n.Children[i] = r n.Children[i] = r
return n, err return b.tryCollapseBranch(n), err
} }
n.Children[i] = r n.Children[i] = r
} }
@ -276,10 +276,7 @@ func (b *Billet) traverse(curr Node, path, from []byte, process func(pathToNode
return nil, err return nil, err
} }
n.next = r n.next = r
if err != nil { return b.tryCollapseExtension(n), err
return n, err
}
return b.tryCollapseExtension(n), nil
default: default:
return nil, ErrNotFound return nil, ErrNotFound
} }