Replies: 1 comment
-
To handle re-org, you may use the standard json rpc API, it contains a const changes = await provider.send('eth_getfilterchanges', [filter]);
for(const log of changes) {
if(log.removed) {
// handle log removed
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Richard,
I'm trying to listen to event X and make sure each instance of it is processed exactly once (even if multiple instances of the same event are fired within 1 tx) using
contract.on("EventName", handleEvent).
What would be a sane way to do this? Currently I'm using code likewhere
getTransactionProcessed
andsetTransactionProcessed
make sure that if the tx is sent again from another node, it won't be processed twice. I've tried to do this withlogIndex
but doesn't seem 100% reliable. How do I handle re-orgs? For example, I've had a situation where thelogIndex
is two different numbers when this handler is called twice (there was only one instance of the event in the tx):Thanks!
Beta Was this translation helpful? Give feedback.
All reactions