hirosystems / ordinals-api

Bitcoin Ordinals API
Apache License 2.0
200 stars 62 forks source link

Transfers per Block returns less results than limit #355

Open forgxyz opened 4 months ago

forgxyz commented 4 months ago

Cross-posting from Discord

I have an issue that is causing reliability issues with our backfill and will create issues if we use this for prod to keep up with chainhead data. There are some blocks that do not return a full page with a request. E.g. block 840480. Response total indicates 67. Sending a request with offset 0 and limit 60 returns 56. Page 2 (offet 60/limit 60) returns 7 for a total of 63.

Now, if I send offset 56 (& limit 60) I get 11, for a grand total of 67 which is expected. However, not getting a full page (results=limit) is an issue

curl -L 'https://api.hiro.so/ordinals/v1/inscriptions/transfers?block=840480&offset=0&limit=60' \
-H 'Accept: application/json' > temp/840480.json

Block 839852 offset 360 looks to be the worst offender with just 29/60 (total = 1361)

import requests
len(requests.get('https://api.hiro.so/ordinals/v1/inscriptions/transfers?block=839852&offset=360&limit=60').json()['results'])

@WHYTEWYLL @sam-xyz

lgalabru commented 4 months ago

Thanks for the feedback @forgxyz! I'm moving this issue to the ordinals-api for better tracking.