kadena-io / chainweb-stream

Streaming server for chainweb events
5 stars 1 forks source link

Feat/send cut heights #5

Closed Takadenoshi closed 1 year ago

Takadenoshi commented 1 year ago

Implemented a new event heights:

Update: A timely cw-data outage showed that we should not rely on the cw-node cut, so switching to getting the max height seen on cw-data and using that instead.

cw-node cut may be put back in the future if it proves useful.

Takadenoshi commented 1 year ago

The original decision to use cw-node heights came after a discussion about the appropriate API to query cw-data's "cut", which there was none. cw-node was used instead, but this already caused issues when querying a cw-stream-server that relied on a stalled cw-data.

I worked around the lack of an API by polling /txs/events?name=coin.TRANSFER?limit=1 which does include coinbase txns and returns txns sorted by height high->low. It is also indexed so it is very performant.

Including coinbase means this can be relied upon to track even idle chains, like testnet04 can be at times.

Some rejected approaches:

/txs/recents does not include coinbase txns

/stats .transactionCount could have been a proxy but it doesn't include coinbase in count either

So we query: