From c0d8eee418c2c2a112e052153fe689b93351c9af Mon Sep 17 00:00:00 2001 From: bendanzhentan <455462586@qq.com> Date: Mon, 15 Jan 2024 19:16:02 +0800 Subject: [PATCH] log branch node --- trie/proof.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/trie/proof.go b/trie/proof.go index 27699c27c1..c0826f5199 100644 --- a/trie/proof.go +++ b/trie/proof.go @@ -61,11 +61,19 @@ func (t *Trie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) e } nodes = append(nodes, n) case *fullNode: - tn = n.Children[key[0]] - prefix = append(prefix, key[0]) - key = key[1:] - nodes = append(nodes, n) - log.Info("bilibili loop", "marker", hexutils.BytesToHex(marker), "index", i, "type", "FULL NODE") + if len(key) == 0 { + nodes = append(nodes, n) + tn = nil + log.Info("bilibili loop", "marker", hexutils.BytesToHex(marker), "index", i, "type", "FULL NODE", "key1", len(key)) + } else { + + tn = n.Children[key[0]] + prefix = append(prefix, key[0]) + key = key[1:] + nodes = append(nodes, n) + log.Info("bilibili loop", "marker", hexutils.BytesToHex(marker), "index", i, "type", "FULL NODE", "key", len(key)) + } + case hashNode: log.Info("bilibili loop", "marker", hexutils.BytesToHex(marker), "index", i, "type", "HASH NODE") // Retrieve the specified node from the underlying node reader.