core/rawdb: preallocate slice in iterateTransactions

This commit is contained in:
Lessa 2026-01-27 09:52:26 -05:00 committed by GitHub
parent 181a3ae9e0
commit 7ce4b1b82a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -153,9 +153,9 @@ func iterateTransactions(db ethdb.Database, from uint64, to uint64, reverse bool
err: err,
}
} else {
var hashes []common.Hash
for _, tx := range body.Transactions {
hashes = append(hashes, tx.Hash())
hashes := make([]common.Hash, len(body.Transactions))
for i, tx := range body.Transactions {
hashes[i] = tx.Hash()
}
result = &blockTxHashes{
hashes: hashes,