core/rawdb: fix nil deref in BenchmarkWriteAncientBlocks

This commit is contained in:
Martin Holst Swende 2024-10-24 09:55:34 +02:00
parent d6bcad1c3e
commit 6995ebd301
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -649,11 +649,15 @@ func makeTestBlocks(nblock int, txsPerBlock int) []*types.Block {
// makeTestReceipts creates fake receipts for the ancient write benchmark.
func makeTestReceipts(n int, nPerBlock int) []types.Receipts {
receipts := make([]*types.Receipt, nPerBlock)
var logs []*types.Log
for i := 0; i < 5; i++ {
logs = append(logs, new(types.Log))
}
for i := 0; i < len(receipts); i++ {
receipts[i] = &types.Receipt{
Status: types.ReceiptStatusSuccessful,
CumulativeGasUsed: 0x888888888,
Logs: make([]*types.Log, 5),
Logs: logs,
}
}
allReceipts := make([]types.Receipts, n)