Skip to content

Commit 8994f98

Browse files
authored
Fix capacity for immediate appends (#10528)
Fixes #10504
1 parent 43da724 commit 8994f98

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

cmd/snapshots/manifest/manifest.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ import (
1212
"strings"
1313
"time"
1414

15+
"github.com/urfave/cli/v2"
16+
1517
"github.com/ledgerwatch/erigon-lib/downloader"
1618
"github.com/ledgerwatch/erigon-lib/downloader/snaptype"
1719
"github.com/ledgerwatch/erigon/cmd/snapshots/sync"
1820
"github.com/ledgerwatch/erigon/cmd/utils"
1921
"github.com/ledgerwatch/erigon/turbo/logging"
20-
"github.com/urfave/cli/v2"
2122
)
2223

2324
var (
@@ -286,7 +287,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v
286287
var extra string
287288

288289
if len(manifestFiles) != 0 {
289-
files := make([]string, len(manifestFiles))
290+
files := make([]string, 0, len(manifestFiles))
290291

291292
for file := range manifestFiles {
292293
files = append(files, file)
@@ -296,7 +297,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v
296297
}
297298

298299
if len(dirFiles) != 0 {
299-
files := make([]string, len(dirFiles))
300+
files := make([]string, 0, len(dirFiles))
300301

301302
for file := range dirFiles {
302303
files = append(files, file)

core/blockchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func logReceipts(receipts types.Receipts, txns types.Transactions, cc *chain.Con
233233
return
234234
}
235235

236-
marshalled := make([]map[string]interface{}, len(receipts))
236+
marshalled := make([]map[string]interface{}, 0, len(receipts))
237237
for i, receipt := range receipts {
238238
txn := txns[i]
239239
marshalled = append(marshalled, ethutils.MarshalReceipt(receipt, txn, cc, header, txn.Hash(), true))

diagnostics/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func writeLogsList(w http.ResponseWriter, dirPath string) {
7070
Size int64 `json:"size"`
7171
}
7272

73-
files := make([]file, len(infos))
73+
files := make([]file, 0, len(infos))
7474

7575
for _, fileInfo := range infos {
7676
files = append(files, file{Name: fileInfo.Name(), Size: fileInfo.Size()})

0 commit comments

Comments
 (0)