hirosystems / ordhook

Build indexers, standards and protocols on top of Ordinals and Inscriptions (BRC20, etc).
Apache License 2.0
174 stars 54 forks source link

ordhook only sends data to ordinals-api up to a slightly older block #319

Closed duyquoc1508 closed 1 month ago

duyquoc1508 commented 1 month ago

Description

When running ordhook and ordinals-api on a server, I encountered an issue related to data synchronization between the two components. ordhook is expected to send blockchain data to ordinals-api up to the latest indexed block. However, under certain conditions, ordhook only sends data up to a slightly older block, this leads to synchronization gaps and errors in data processing.

Current Behavior:

  1. ordhook has synchronized blockchain data up to the latest indexed block (#848288) at 2024-06-17T06:04:14.616469649Z.

  2. ordinals-api begins registering predicates from block #848277 at 2024-06-17T06:10:46.694234931Z.

  3. While ordhook is transmitting data to ordinals-api, a new block (#848289) is mined on the network at 2024-06-17T06:13:15.61295629Z.

  4. Despite the availability of block #848289, ordhook only sends data up to block #848288 and logs the following:

  {"msg":"12 blocks scanned, 12 actions triggered","level":"INFO","ts":"2024-06-17T06:13:52.561986138Z"}
  {"msg":"Enabling Predicate ***-***-***","level":"INFO","ts":"2024-06-17T06:13:52.562331498Z"}
  1. After receiving block #848290, ordhook resumes sending data to ordinals-api, skipping block #848289 entirely.

  2. This behavior causes ordinals-api to miss block #848289, leading to the error "Block inscription gap detected".

Expected Behavior:

  1. ordhook should consistently send blockchain data to ordinals-api up to the latest indexed block (#848289)

Additional

The issue does not occur when ordinals-api starts and receives data from ordhook whithout new blocks being mined during the process

Environment:

Ordhook docker image: hirosystems/ordhook:2.1.0

lgalabru commented 1 month ago

Thank you @duyquoc1508! I believe this issue was addressed in 2.2.1, feel free to re-open if you're still experiencing it!

lgalabru commented 1 month ago

https://github.com/hirosystems/ordhook/pull/312