From 7b540584d12c1661b22f7b451ff65050cfdbf195 Mon Sep 17 00:00:00 2001 From: Abhishek Katiyar Date: Thu, 9 Jun 2022 18:29:21 +0530 Subject: [PATCH] Abhishek | Ensure contract address is considered only when its not an empty string To ensure logs can be fetched even when logs need not filtered by contract address --- rpc/eth_rpc.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpc/eth_rpc.go b/rpc/eth_rpc.go index bbdab52..4374c01 100644 --- a/rpc/eth_rpc.go +++ b/rpc/eth_rpc.go @@ -64,10 +64,13 @@ func (rpc EthBlockChainRPC) GetLogs( filterParam := ethrpc.FilterParams{ FromBlock: "0x" + strconv.FormatUint(fromBlockNum, 16), ToBlock: "0x" + strconv.FormatUint(toBlockNum, 16), - Address: []string{address}, Topics: [][]string{topics}, } + if address != "" { + filterParam.Address = []string{address} + } + logs, err := rpc.rpcImpl.EthGetLogs(filterParam) if err != nil { logrus.Warnf("EthGetLogs err: %s, params: %+v", err, filterParam)