Skip to content

Commit

Permalink
deduplication of deletion proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
noel2004 committed Apr 10, 2023
1 parent c1c2c00 commit e649e1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions trie/zktrie_deletionproof.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (t *ProofTracer) Merge(another *ProofTracer) *ProofTracer {
// always decode the node for its purpose
func (t *ProofTracer) GetDeletionProofs() ([][]byte, error) {

var ret [][]byte
retMap := map[zkt.Hash][]byte{}

// check each path: reversively, skip the final leaf node
for _, path := range t.rawPaths {
Expand All @@ -93,13 +93,17 @@ func (t *ProofTracer) GetDeletionProofs() ([][]byte, error) {
return nil, err
}
if sibling.Type != zktrie.NodeTypeEmpty {
ret = append(ret, sibling.Value())
retMap[*siblingHash] = sibling.Value()
}
}
break
}
}
}

var ret [][]byte
for _, bt := range retMap {
ret = append(ret, bt)
}

return ret, nil
Expand Down

0 comments on commit e649e1b

Please sign in to comment.