From c4aee353733faa626bfa2ecea55c0880c8557433 Mon Sep 17 00:00:00 2001 From: Matt D Date: Sun, 4 May 2025 05:59:57 +0500 Subject: [PATCH] use slices.Concat to replace append(nil) --- trie/sync.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trie/sync.go b/trie/sync.go index 3b7caae5b1..9bc9fea036 100644 --- a/trie/sync.go +++ b/trie/sync.go @@ -19,6 +19,7 @@ package trie import ( "errors" "fmt" + "slices" "sync" "github.com/ethereum/go-ethereum/common" @@ -553,7 +554,7 @@ func (s *Sync) children(req *nodeRequest, object node) ([]*nodeRequest, error) { } children = []childNode{{ node: node.Val, - path: append(append([]byte(nil), req.path...), key...), + path: slices.Concat(req.path, key), }} // Mark all internal nodes between shortNode and its **in disk** // child as invalid. This is essential in the case of path mode @@ -595,7 +596,7 @@ func (s *Sync) children(req *nodeRequest, object node) ([]*nodeRequest, error) { if node.Children[i] != nil { children = append(children, childNode{ node: node.Children[i], - path: append(append([]byte(nil), req.path...), byte(i)), + path: append(slices.Concat(req.path), byte(i)), }) } }