Page MenuHomePhabricator

[Chronik] Allow subscribing to WebSocket script updates
ClosedPublic

Authored by tobias_ruck on Apr 25 2023, 22:09.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC2cc866019038: [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

Diff Detail

Event Timeline

tobias_ruck retitled this revision from [Chronik] Add subscribing to WebSocket script updates to [Chronik] Allow subscribing to WebSocket script updates.Apr 25 2023, 22:10

remove unnecessary quorum constant

remove superfluous . which makes the comment seem insecure

It would be nice to also subscribe to the blocks. This is not needed for wallets for example, and it will make this test simpler.

This revision is now accepted and ready to land.Apr 26 2023, 13:43