Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
Remove logs reverted due to a chain reorg (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrun5 authored Sep 29, 2022
1 parent b25168d commit 20a5360
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion chains/evm/calls/evmclient/evm-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,20 @@ func (c *EVMClient) GetTransactionByHash(h common.Hash) (tx *types.Transaction,
}

func (c *EVMClient) FetchEventLogs(ctx context.Context, contractAddress common.Address, event string, startBlock *big.Int, endBlock *big.Int) ([]types.Log, error) {
return c.FilterLogs(ctx, buildQuery(contractAddress, event, startBlock, endBlock))
logs, err := c.FilterLogs(ctx, buildQuery(contractAddress, event, startBlock, endBlock))
if err != nil {
return []types.Log{}, err
}

validLogs := make([]types.Log, 0)
for _, log := range logs {
if log.Removed {
continue
}

validLogs = append(validLogs, log)
}
return validLogs, nil
}

// SendRawTransaction accepts rlp-encode of signed transaction and sends it via RPC call
Expand Down

0 comments on commit 20a5360

Please sign in to comment.