ChainSafe / chainbridge-celo

GNU Lesser General Public License v3.0
3 stars 2 forks source link

Create new pollblocks function for Listener #39

Closed steviezhang closed 4 years ago

steviezhang commented 4 years ago

The block poller should live in chainbridge-celo/chain/listener.go

It should follow a format similar to that of our existing ethereum block poller (should be used as reference.)

The function should look like this:

func (l *listener) pollBlocks() error 

It should poll the network for the latest block and parse the events as it sees new blocks. Polling should begin at the block defined in the config. There should be some integer value BlockRetryLimit set in the listener that is the number of we should retry fetching the latest block until we skip and try to parse the next block.

It should use the getDepositEventsAndProofsForBlock function to parse each block.

We should run the listener's syncer's sync function every time we parse a block.