trie/trienode: remove unnecessary check in Summary (#30047)

This commit is contained in:
maskpp 2024-06-25 21:45:33 +08:00 committed by GitHub
parent 98b5930d2d
commit 9298d2db88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 9 deletions

View File

@ -139,16 +139,14 @@ func (set *NodeSet) Size() (int, int) {
func (set *NodeSet) Summary() string {
var out = new(strings.Builder)
fmt.Fprintf(out, "nodeset owner: %v\n", set.Owner)
if set.Nodes != nil {
for path, n := range set.Nodes {
// Deletion
if n.IsDeleted() {
fmt.Fprintf(out, " [-]: %x\n", path)
continue
}
// Insertion or update
fmt.Fprintf(out, " [+/*]: %x -> %v \n", path, n.Hash)
for path, n := range set.Nodes {
// Deletion
if n.IsDeleted() {
fmt.Fprintf(out, " [-]: %x\n", path)
continue
}
// Insertion or update
fmt.Fprintf(out, " [+/*]: %x -> %v \n", path, n.Hash)
}
for _, n := range set.Leaves {
fmt.Fprintf(out, "[leaf]: %v\n", n)