From af14bfca24f7bd759c011c8621bc4fd7829f096f Mon Sep 17 00:00:00 2001 From: alex017 Date: Thu, 29 Jan 2026 17:22:28 +0100 Subject: [PATCH] Update history_trienode.go --- triedb/pathdb/history_trienode.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/triedb/pathdb/history_trienode.go b/triedb/pathdb/history_trienode.go index 05a43808c2..1f63e6b438 100644 --- a/triedb/pathdb/history_trienode.go +++ b/triedb/pathdb/history_trienode.go @@ -391,15 +391,15 @@ func decodeKeyEntry(keySection []byte, offset int) (uint64, uint64, []byte, int, // decodeRestartTrailer resolves all the offsets recorded at the trailer. func decodeRestartTrailer(keySection []byte) ([]uint32, []uint32, int, error) { - var ( - keyOffsets []uint32 - valOffsets []uint32 - ) // Decode the number of restart section if len(keySection) < 4 { return nil, nil, 0, fmt.Errorf("key section too short, size: %d", len(keySection)) } nRestarts := binary.BigEndian.Uint32(keySection[len(keySection)-4:]) + var ( + keyOffsets = make([]uint32, 0, int(nRestarts)) + valOffsets = make([]uint32, 0, int(nRestarts)) + ) // Decode the trailer if len(keySection) < int(8*nRestarts)+4 {