HomePhabricator

[Chronik] Allow subscribing to WebSocket script updates

Description

[Chronik] Allow subscribing to WebSocket script updates

Summary:
Allow sending WsSub protobuf message to the server to subscribe to specific scripts, and the server will send WsMsg with MsgTx when a tx with a matching script has an update.

Updates can be added to/removed from the mempool, or confirmed in a block.

NNG Chronik also has a "Reorg" event type, which is fired for all txs disconnected in a block, but it's not clear whether this is useful.

We only send out an update once for a tx, even if it contains a subscribed script multiple times.

However, if a client is subscribed to multiple different scripts, we do send out multiple updates for the same tx if a script contains multiple different subscribed scripts. This is because those are handled competely separately.

Depends on D13779 and D13780.

Test Plan: ninja && ./test/functional/test_runner.py chronik_ws_script

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

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

Details

Provenance
tobias_ruckAuthored on Apr 26 2023, 11:49
tobias_ruckPushed on Apr 26 2023, 13:48
Reviewer
Restricted Project
Differential Revision
D13781: [Chronik] Allow subscribing to WebSocket script updates
Parents
rABC0908f22bd441: [Chronik] Require subscribing to WebSocket block updates
Branches
Unknown
Tags
Unknown