Blockchain Reader polls Insight for blocks periodically, running every X seconds.
As long as X is less than the average time new blocks take to generate in the blockchain, Po.et Node will be always up to date.
This approach works well when Po.et Node is already up to date, but if it is started thousands of blocks behind the tip, it'll take forever to catch up.
In this special case, we need Blockchain Reader to poll for blocks much, much faster. We can do this by
This "fastMethod" would run scanBlock(index) just like the cron, keeping track of the index and increasing it constantly, but instead of running every X amount of time, it'd run new requests as soon as the previous one is finished.
It should also run several requests in parallel, since most of the function time is spent on awaits, running up to N requests in parallel.
Blockchain Reader polls Insight for blocks periodically, running every X seconds.
As long as X is less than the average time new blocks take to generate in the blockchain, Po.et Node will be always up to date.
This approach works well when Po.et Node is already up to date, but if it is started thousands of blocks behind the tip, it'll take forever to catch up.
In this special case, we need Blockchain Reader to poll for blocks much, much faster. We can do this by
This "fastMethod" would run
scanBlock(index)
just like the cron, keeping track of the index and increasing it constantly, but instead of running every X amount of time, it'd run new requests as soon as the previous one is finished. It should also run several requests in parallel, since most of the function time is spent onawait
s, running up to N requests in parallel.