diff --git a/eth/filters/api.go b/eth/filters/api.go index 63e7f98e5..107acef46 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -420,10 +420,20 @@ func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ty return nil, fmt.Errorf("filter not found") } + borConfig := api.chainConfig.Bor + var filter *Filter + + var borLogsFilter *BorBlockLogsFilter + if f.crit.BlockHash != nil { // Block filter requested, construct a single-shot filter filter = NewBlockFilter(api.backend, *f.crit.BlockHash, f.crit.Addresses, f.crit.Topics) + + // Block bor filter + if api.borLogs { + borLogsFilter = NewBorBlockLogsFilter(api.backend, borConfig.Sprint, *f.crit.BlockHash, f.crit.Addresses, f.crit.Topics) + } } else { // Convert the RPC block numbers into internal representations begin := rpc.LatestBlockNumber.Int64() @@ -436,12 +446,27 @@ func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ty } // Construct the range filter filter = NewRangeFilter(api.backend, begin, end, f.crit.Addresses, f.crit.Topics) + + if api.borLogs { + borLogsFilter = NewBorBlockLogsRangeFilter(api.backend, borConfig.Sprint, begin, end, f.crit.Addresses, f.crit.Topics) + } } // Run the filter and return all the logs logs, err := filter.Logs(ctx) if err != nil { return nil, err } + + if borLogsFilter != nil { + // Run the filter and return all the logs + borBlockLogs, err := borLogsFilter.Logs(ctx) + if err != nil { + return nil, err + } + + return returnLogs(types.MergeBorLogs(logs, borBlockLogs)), nil + } + return returnLogs(logs), nil }