diff --git a/rpc/websockets.go b/rpc/websockets.go index 03dbc68128..d93b501138 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -575,13 +575,21 @@ func (api *pubSubAPI) subscribeLogs(wsConn *wsConn, subID rpc.ID, extra interfac continue } - txResponse, err := evmtypes.DecodeTxResponse(dataTx.TxResult.Result.Data) - if err != nil { - api.logger.Error("failed to decode tx response", "error", err.Error()) - return + unfiltered := make([]*ethtypes.Log, 0) + for _, event := range dataTx.Result.Events { + if event.Type != evmtypes.EventTypeTxLog { + continue + } + for _, attr := range event.Attributes { + if bytes.Equal(attr.Key, []byte(evmtypes.AttributeKeyTxLog)) { + var log evmtypes.Log + if json.Unmarshal(attr.Value, &log) == nil { + unfiltered = append(unfiltered, log.ToEthereum()) + } + } + } } - - logs := rpcfilters.FilterLogs(evmtypes.LogsToEthereum(txResponse.Logs), crit.FromBlock, crit.ToBlock, crit.Addresses, crit.Topics) + logs := rpcfilters.FilterLogs(unfiltered, crit.FromBlock, crit.ToBlock, crit.Addresses, crit.Topics) if len(logs) == 0 { continue }