Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EthereumRegistryWriter: onCidAdded restart resiliency #954

Open
lautarodragan opened this issue Dec 2, 2019 · 0 comments
Open

EthereumRegistryWriter: onCidAdded restart resiliency #954

lautarodragan opened this issue Dec 2, 2019 · 0 comments
Labels

Comments

@lautarodragan
Copy link
Member

lautarodragan commented Dec 2, 2019

Currently if EthereumRegistryWriter is restarted after an addCid transaction has been sent to geth but before the associated cidAdded event is picked up, that event will never be picked up, since EthereumRegistryWriter always starts listening to cidAdded events from the latest block geth has seen.

This can be solved by indexing onCidAdded.blockNumber in the db, pick up the highest onCidAdded.blockNumber on startup and passing that to fromBlock.

const fromBlock = await db. // some aggregate `sum` function or sort by and findOne
const onCidAddedPromievent = await ethereumRegistryContract.onCidAdded({ fromBlock }, handleEventError)

The chances of this happening are probably slim so not the highest priority at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant