Closed Takadenoshi closed 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:
Implemented a new event
heights
:this sends an event
heights
with payload: ~array of the current cut as seen on chainweb-node~ max height seen on chainweb-data. Structure:{ "data": <numeric height> }
Needed to implement better reconnections. The corresponding client PR will use this value to resume with better guarantees of event delivery.
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.