HomePhabricator

[chronik] implement blockchain.block.header electrum method

Description

[chronik] implement blockchain.block.header electrum method

Summary:
Return the block header at the given height. If cp_height is zero, return the raw block header as a hexadecimal string. Otherwise a dictionary with the raw block header, the merkle root of all headers up to and including cp_height, and the merkle branch of header up to root.

See https://electrum-cash-protocol.readthedocs.io/en/latest/protocol-methods.html#blockchain-block-header
Depends on D17496

Test Plan:
ninja check-functional

On mainnet, check results against fulcrum:

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

echo '{"jsonrpc": "2.0", "method": "blockchain.block.header",  "params": [400000, 800000], "id": "test"}' | nc 127.0.0.1 50001
echo '{"jsonrpc": "2.0", "method": "blockchain.block.header",  "params": [400000, 800000], "id": "test"}' | nc electrum.bitcoinabc.org 50001

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Tue, Jan 7, 14:26
PiRKPushed on Thu, Jan 9, 14:31
Reviewer
Restricted Project
Differential Revision
D17485: [chronik] implement blockchain.block.header electrum method
Parents
rABCdbd1f19eb7b9: [Cashtab] Improve form entry and validation for listing tokens on agora
Branches
Unknown
Tags
Unknown