HomePhabricator

[chronik] Electrum: add the blockchain.headers.subscribe endpoint

Description

[chronik] Electrum: add the blockchain.headers.subscribe endpoint

Summary: Subscribe to get the new header when a block is connected.

Test Plan:

./test/functional/test_runner.py chronik_electrum_*

In terminal 1:

./src/bitcoind -regtest -debug=chronik -chronik -chronikscripthashindex -chronikelectrumbind="127.0.0.1:50001"

In terminal 2 (can be done in several terminals):

echo '{"jsonrpc": "2.0", "method": "blockchain.headers.subscribe", "params": [], "id": "test"}' | nc 127.0.0.1 50001 | jq

in terminal 3:

./src/bitcoin-cli -regtest createwallet regtest
./src/bitcoin-cli -regtest -generate 1

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK, tobias_ruck

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