Open botnumberseven opened 1 year ago
@botnumberseven In fact, this is true. The transactions API will lag behind the finalized_blockNum
field on the finalized block num. Subscan will lag behind by about 3 blocks because it needs checks and synchronization.
Appreciate quick response @freehere107
I have no issues with the lag itself. But this specifics in a behaviour matters a lot. E.g. For a while I've been pulling transactions data based on finalized_blockNum, but read empty data. And I had no simple way to notice that I pull incorrect data.
In my case i added a delay for 10 blocks. But you might want to consider some non-success response thru transactions API in case user tries to pull data for finalized-but-not-available-thru-transactions-API block. Or at least put a note in documentation for transactions API, so user knows what to expect.
Thanks for your suggestion, I will add this reminder to the documentation in a few days.
Confirmation
Affected Network(s)
OriginTrail Parachain
Steps to reproduce
I'm using metadata API to get the value of the latest finalized block (finalized_blockNum): curl -X POST 'https://origintrail.api.subscan.io/api/scan/metadata' \ --header 'Content-Type: application/json' \ --header 'X-API-Key: YOUR_API'
Then i pull TXs data for that block using transactions API: curl -X POST 'https://origintrail.api.subscan.io/api/scan/evm/transactions' \ --header 'Content-Type: application/json' \ --header 'X-API-Key: YOUR_API' \ --data-raw '{ "block_num": 2265183 }'
And transactions API returns incorrect data. Consider the example below. Metadata returned 2265183 as finalized_blockNum Within a second or two I called transactions API for this block and got back a success with no transactions data. Then I waited ~30sec made the same call and now I got back a response with transactions data.
Expected output
If metadata API tells me X is the finalized block, I expect transactions API to be able to return transactions data for that block.
Actual output
Transactions API returns Null, instead of txs data for the last (or maybe not only last) finalized block. Looks like transactions API lags behind metadata API.
Additional factoids or references
No response