Skip to content

Commit

Permalink
eth: use new readlogs accessor when filtering logs
Browse files Browse the repository at this point in the history
  • Loading branch information
s1na committed Aug 9, 2021
1 parent f343410 commit 1c41fba
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions eth/api_backend.go
Expand Up @@ -181,13 +181,14 @@ func (b *EthAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (type
}

func (b *EthAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
receipts := b.eth.blockchain.GetReceiptsByHash(hash)
if receipts == nil {
return nil, nil
db := b.eth.ChainDb()
number := rawdb.ReadHeaderNumber(db, hash)
if number == nil {
return nil, errors.New("failed to get block number from hash")
}
logs := make([][]*types.Log, len(receipts))
for i, receipt := range receipts {
logs[i] = receipt.Logs
logs := rawdb.ReadLogs(db, hash, *number)
if logs == nil {
return nil, errors.New("failed to get logs for block")
}
return logs, nil
}
Expand Down

0 comments on commit 1c41fba

Please sign in to comment.