ethereumjs / ethereumjs-blockstream

Reliable stream of Ethereum blocks
MIT License
80 stars 19 forks source link

Fixes bug where an Ethereum node giving bad answers could break things. #18

Closed MicahZoltu closed 6 years ago

MicahZoltu commented 6 years ago

This changes the way we announce block/log additions/removals so that we wait until we are sure we can fully synch with the node before doing any announcements. This allows us to rollback when the Ethereum node gives us something weird in response such as a claim that a parent block doesn't exist, or logs that don't line up with the expected block.

Reorders block/log additions/removals. It now guarantees that you'll receive block addition announcements before receiving log addition announcements for that block and you'll receive log removal announcements before receiving block removal announcements for that block.

No longer does console.log when an error occurs, instead calls the optional user provided onError. This cleans up the tests, and also allows the user to do something more useful with errors like track them externally.

Removes deprecated ES5 callback stuff.

MicahZoltu commented 6 years ago

Fixes #17.

MicahZoltu commented 6 years ago

Pinging @epheph @mohoff @LogvinovLeon to see if anyone wants to review this PR. I currently have the flu so I don't really trust my abilities at the moment and there may be some glaringly obvious problem. If I don't hear from anyone by the time I am feeling better I'll review it myself in a few days (after having forgotten what I have done here today).