Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle edge cases involving blocks not being found in the db
One case is where there is a backfill followed by an error, so that logs get written to the db but no blocks. This will make the logpoller (or backup log poller) rely on the chain next time instead of the db to determine lastFinalizedBlock, which could result in a gap in logs processed. Fixing this by writing the last block in the backfil to the db along with the logs. Its lastFinalizedBlock field will be set to its own block number + 1, so if the db crashes it should start by pulling the logs from that one. The second case is even more rare, and could only happen in a situation where the log poller just recently started on a new chain, and there is a re-org of depth R which happens N blocks into the chain (after N blocks have been pulled and saved to the db), where 1 < N < R < finalizationDepth. So this would have to be a re-org of at least depth 2 that happens at exactly the wrong moment.
- Loading branch information