Skip to content

Commit

Permalink
Merge pull request #28 from kaleido-io/catchup-filter
Browse files Browse the repository at this point in the history
Add contract address to filter for catchup
  • Loading branch information
peterbroadhurst authored Aug 31, 2022
2 parents 5d5130c + 899888c commit 84e3108
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/ethereum/event_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,15 +485,20 @@ func (es *eventStream) filterEnrichSort(ctx context.Context, ag *aggregatedListe
}

func (es *eventStream) getBlockRangeEvents(ctx context.Context, ag *aggregatedListener, fromBlock, toBlock int64) (ffcapi.ListenerEvents, error) {

var ethLogs []*logJSONRPC
err := es.c.backend.CallRPC(ctx, &ethLogs, "eth_getLogs", &logFilterJSONRPC{
logFilterJSONRPCReq := &logFilterJSONRPC{
FromBlock: ethtypes.NewHexInteger64(fromBlock),
ToBlock: ethtypes.NewHexInteger64(toBlock),
Topics: [][]ethtypes.HexBytes0xPrefix{
ag.signatureSet,
},
})
}

if len(ag.listeners) == 1 && len(ag.listeners[0].config.filters) == 1 {
logFilterJSONRPCReq.Address = ag.listeners[0].config.filters[0].Address
}

err := es.c.backend.CallRPC(ctx, &ethLogs, "eth_getLogs", logFilterJSONRPCReq)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 84e3108

Please sign in to comment.