Skip to content

Commit

Permalink
Fix capacity for immediate appends (#10528)
Browse files Browse the repository at this point in the history
Fixes #10504
  • Loading branch information
shohamc1 authored and yperbasis committed May 29, 2024
1 parent f13762b commit 4609364
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions cmd/snapshots/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import (
"strings"
"time"

"github.com/urfave/cli/v2"

"github.com/ledgerwatch/erigon-lib/downloader"
"github.com/ledgerwatch/erigon-lib/downloader/snaptype"
"github.com/ledgerwatch/erigon/cmd/snapshots/sync"
"github.com/ledgerwatch/erigon/cmd/utils"
"github.com/ledgerwatch/erigon/turbo/logging"
"github.com/urfave/cli/v2"
)

var (
Expand Down Expand Up @@ -286,7 +287,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v
var extra string

if len(manifestFiles) != 0 {
files := make([]string, len(manifestFiles))
files := make([]string, 0, len(manifestFiles))

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

if len(dirFiles) != 0 {
files := make([]string, len(dirFiles))
files := make([]string, 0, len(dirFiles))

for file := range dirFiles {
files = append(files, file)
Expand Down
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func logReceipts(receipts types.Receipts, txns types.Transactions, cc *chain.Con
return
}

marshalled := make([]map[string]interface{}, len(receipts))
marshalled := make([]map[string]interface{}, 0, len(receipts))
for i, receipt := range receipts {
txn := txns[i]
marshalled = append(marshalled, ethutils.MarshalReceipt(receipt, txn, cc, header, txn.Hash(), true))
Expand Down
2 changes: 1 addition & 1 deletion diagnostics/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func writeLogsList(w http.ResponseWriter, dirPath string) {
Size int64 `json:"size"`
}

files := make([]file, len(infos))
files := make([]file, 0, len(infos))

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

0 comments on commit 4609364

Please sign in to comment.