Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bendanzhentan committed Jan 17, 2024
1 parent 64776b5 commit 962257d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions trie/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ func (t *Trie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) e
for len(key) > 0 && tn != nil {
switch n := tn.(type) {
case *shortNode:
log.Info("bilibili loop", "marker", marker, "i", i, "type", "ShortNode", "key", len(key), "n.Key", len(n.Key))
if len(key) < len(n.Key) || !bytes.Equal(n.Key, key[:len(n.Key)]) {
// The trie doesn't contain the key.
log.Info("bilibili loop", "marker", marker, "i", i, "type", "ShortNode-1", "key", len(key), "n.Key", len(n.Key))
nodes = append(nodes, n)
tn = nil
} else {
log.Info("bilibili loop", "marker", marker, "i", i, "type", "ShortNode-2", "key", len(key), "n.Key", len(n.Key))
nodes = append(nodes, n)
tn = n.Val
prefix = append(prefix, n.Key...)
key = key[len(n.Key):]
}
nodes = append(nodes, n)

if len(key) == 0 {
log.Info("bilibili loop", "marker", marker, "i", i, "type", "ShortNode-2", "key", len(key), "n.Key", len(n.Key))
nodes = append(nodes, tn)
if len(key) == 0 {
log.Info("bilibili loop", "marker", marker, "i", i, "type", "ShortNode-3", "key", len(key), "n.Key", len(n.Key))
nodes = append(nodes, tn)
}
}

case *fullNode:
log.Info("bilibili loop", "marker", marker, "i", i, "type", "FullNode", "key", len(key))
tn = n.Children[key[0]]
Expand Down

0 comments on commit 962257d

Please sign in to comment.