Skip to content

Commit

Permalink
fix offset initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangTao1596 committed Sep 27, 2021
1 parent c0bb707 commit 14bd013
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/StateService/MPT/MPTTrie.Find.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ private ReadOnlySpan<byte> Seek(ref MPTNode node, ReadOnlySpan<byte> path, out M
{
if (!from.AsSpan().StartsWith(prefix))
throw new InvalidOperationException("invalid from key");
offset = prefix.Length * 2;
from = ToNibbles(from.AsSpan());
}
if (path.Length > MPTNode.MaxKeyLength || from.Length > MPTNode.MaxKeyLength)
throw new ArgumentException("exceeds limit");
path = Seek(ref root, path, out MPTNode start).ToArray();
offset = path.Length;
return Travers(start, path, from, offset)
.Select(p => (FromNibbles(p.Key).AsSerializable<TKey>(), p.Value.AsSerializable<TValue>()));
}
Expand Down

0 comments on commit 14bd013

Please sign in to comment.