chore: rename collectLogsAndReceipts to collectReceiptsAndLogs

This commit is contained in:
10gic 2025-09-30 14:11:39 +08:00 committed by GitHub
parent 4b926f6645
commit 9168002c47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2347,13 +2347,13 @@ func (bc *BlockChain) recoverAncestors(block *types.Block, makeWitness bool) (co
// collectLogs collects the logs that were generated or removed during the // collectLogs collects the logs that were generated or removed during the
// processing of a block. These logs are later announced as deleted or reborn. // processing of a block. These logs are later announced as deleted or reborn.
func (bc *BlockChain) collectLogs(b *types.Block, removed bool) []*types.Log { func (bc *BlockChain) collectLogs(b *types.Block, removed bool) []*types.Log {
_, logs := bc.collectLogsAndReceipts(b, removed) _, logs := bc.collectReceiptsAndLogs(b, removed)
return logs return logs
} }
// collectLogsAndReceipts retrieves receipts from the database and returns both receipts and logs. // collectReceiptsAndLogs retrieves receipts from the database and returns both receipts and logs.
// This avoids duplicate database reads when both are needed. // This avoids duplicate database reads when both are needed.
func (bc *BlockChain) collectLogsAndReceipts(b *types.Block, removed bool) ([]*types.Receipt, []*types.Log) { func (bc *BlockChain) collectReceiptsAndLogs(b *types.Block, removed bool) ([]*types.Receipt, []*types.Log) {
var blobGasPrice *big.Int var blobGasPrice *big.Int
if b.ExcessBlobGas() != nil { if b.ExcessBlobGas() != nil {
blobGasPrice = eip4844.CalcBlobFee(bc.chainConfig, b.Header()) blobGasPrice = eip4844.CalcBlobFee(bc.chainConfig, b.Header())
@ -2600,7 +2600,7 @@ func (bc *BlockChain) SetCanonical(head *types.Block) (common.Hash, error) {
bc.writeHeadBlock(head) bc.writeHeadBlock(head)
// Emit events // Emit events
receipts, logs := bc.collectLogsAndReceipts(head, false) receipts, logs := bc.collectReceiptsAndLogs(head, false)
bc.chainFeed.Send(ChainEvent{ bc.chainFeed.Send(ChainEvent{
Header: head.Header(), Header: head.Header(),