Duplicate event on Ropsten

Hello,

I’m using Infura node to listen to events. For the moment I listen from contract events on ROPSTEN blockchain and sometimes, every 100-200events I have a duplicate event sent by Infura.

This event is sent 3times with exact same transaction id. I’m using a websocket to listen to all events with code like this :

MyContract.events.allEvents({}, function (error, event) {
//code here
});

This duplicate event was not here when I used “pastEvents” to get all events after reseting my database.

Is this something I need to worry ? I read somewhere that it’s only on testnet blockchain. I can do a “buffer” when I keep track of the last 10transactions ID so when an event is duplicated I can throw it but just want to know if it’s a known behavior.

Hi @Macha, and welcome to the Infura community!

Sometimes you’ll see duplicate events if Ropsten has a reorg - do your duplicates line up with the timelines seen here on Etherscan of chain reorgs that have occurred? If so, it’s nothing to worry about. If not, let us know and we’ll keep digging!

Hello,

Thanks for your answer. There is also reorg on mainnet if I did read right…
So I think I will need to add a buffer function that check if transactions ID is already added in my database to not have duplicated entries.