Skip to content

Commit db4f15d

Browse files
authored
check logsbloomfilter before look up receipts in getLogs API (#2470)
1 parent 57647ce commit db4f15d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

api/api.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,13 @@ func (api *Server) getLogsInBlock(filter *LogFilter, start, count uint64) ([]*io
14691469
end = api.bc.TipHeight()
14701470
}
14711471
for i := start; i <= end; i++ {
1472+
header, err := api.dao.HeaderByHeight(i)
1473+
if err != nil {
1474+
return logs, status.Error(codes.InvalidArgument, err.Error())
1475+
}
1476+
if !filter.ExistInBloomFilter(header.LogsBloomfilter()) {
1477+
continue
1478+
}
14721479
receipts, err := api.dao.GetReceipts(i)
14731480
if err != nil {
14741481
return logs, status.Error(codes.InvalidArgument, err.Error())

0 commit comments

Comments
 (0)