HomePhabricator

[chronik-client] Support websocket subscriptions to txid

Description

[chronik-client] Support websocket subscriptions to txid

Summary:
Add support for websocket subscriptions to txid

Note: changes to chronik.ts from running the script npm run build-proto

This is a tricky one to test. Would be nice to have just one new file for testing txid ws subscriptions. However, I'm not able to figure out how to make the txids deterministic in tests that finalize blocks with avalanche. We want to show that we can subscribe to a txid before it is broadcast and see it through its various lifecycle stages.

To do this, we

  • Show we can get a tx finalized notification in websockets.ts
  • Show we can get added and removed from mempool notifications in ws_txid.ts, which is an almost-exact-recreation of mempool_conflicts.ts but refactored for txid subs

We could also duplicate websockets.ts and refactor for txid subs. I think this is a bit overkill for the feature introduced here. The issue is that the existing subs tested in websockets.ts would conflict with txid subs. If we subscribe to a txid and also to a script that receives that txid, we only expect one msg to come in for txid events. So we can't really test "both" subscriptions in the same script / test file.

Test Plan: CI tests

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D18251

Details

Provenance
bytesofmanAuthored on Jun 10 2025, 16:36
bytesofmanPushed on Jun 16 2025, 13:15
Reviewer
Restricted Project
Differential Revision
D18251: [chronik-client] Support websocket subscriptions to txid
Parents
rABC9a3cdfbe46b7: [Automated] Update seeds
Branches
Unknown
Tags
Unknown