Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bendanzhentan committed Jan 18, 2024
1 parent 08a2c89 commit bceb629
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion trie/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (h *hasher) proofHash(original node) (collapsed, hashed node) {
switch n := original.(type) {
case *shortNode:
sn, _ := h.hashShortNodeChildren(n)
return sn, h.shortnodeToHash(sn, false)
return sn, h.shortnodeToHash(sn, true)
case *fullNode:
fn, _ := h.hashFullNodeChildren(n)
return fn, h.fullnodeToHash(fn, false)
Expand Down
6 changes: 4 additions & 2 deletions trie/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import (
// nodes of the longest existing prefix of the key (at least the root node), ending
// with the node that proves the absence of the key.
func (t *Trie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error {
res := t.Get(key)
log.Info("bilibili Trie.Get", "key", hexutils.BytesToHex(key), "res", hexutils.BytesToHex(res))
// res := t.Get(key)
// log.Info("bilibili Trie.Get", "key", hexutils.BytesToHex(key), "res", hexutils.BytesToHex(res))

// Collect all nodes on the path to key.
var (
Expand Down Expand Up @@ -121,6 +121,8 @@ func (t *Trie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) e
putted++
log.Info("bilibili proofDb.Put", "marker", marker, "i", i, "nodeType", nodeType, "nodeVal", nodeVal, "ok", ok)
} else {
// 187:INFO [01-18|10:19:28.934] bilibili proofDb.Discard marker=050B0A060B07000F09060602000D02070100020D040709090D0205090F0E00080F0609000C000A02010B08000D000A010A0900030D0B0608020401070A02030F10 i=8 nodeType=shortNode nodeVal=nil ok=false
// 问题出在为什么要 discard shortnode
discard++
log.Info("bilibili proofDb.Discard", "marker", marker, "i", i, "nodeType", nodeType, "nodeVal", nodeVal, "ok", ok)
}
Expand Down

0 comments on commit bceb629

Please sign in to comment.