From 222d180a6b4530be9f2ec46f665738d264ef495f Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Thu, 29 Jan 2026 13:58:36 +0800 Subject: [PATCH] trie: update func `ForEachWithOrder` #27496 #27909 (#1163) Co-authored-by: Dan Laine Co-authored-by: Felix Lange --- trie/trienode/node.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trie/trienode/node.go b/trie/trienode/node.go index 3088359f80..a073a5ce66 100644 --- a/trie/trienode/node.go +++ b/trie/trienode/node.go @@ -100,12 +100,12 @@ func NewNodeSet(owner common.Hash) *NodeSet { // ForEachWithOrder iterates the nodes with the order from bottom to top, // right to left, nodes with the longest path will be iterated first. func (set *NodeSet) ForEachWithOrder(callback func(path string, n *Node)) { - var paths sort.StringSlice + paths := make([]string, 0, len(set.Nodes)) for path := range set.Nodes { paths = append(paths, path) } // Bottom-up, longest path first - sort.Sort(sort.Reverse(paths)) + sort.Sort(sort.Reverse(sort.StringSlice(paths))) for _, path := range paths { callback(path, set.Nodes[path].Unwrap()) }