HomePhabricator

[chronik] implement electrum RPC blockchain.block.headers

Description

[chronik] implement electrum RPC blockchain.block.headers

Summary:
See https://electrum-cash-protocol.readthedocs.io/en/latest/protocol-methods.html#blockchain-block-headers

Note that we have a minor difference in behavior vs Fulcrum:
Fulcrum has an additional check that height, cp_height and start_height are < Storage::MAX_HEADERS (100'000'000), and returns a "Invalid height/cp_height" error message in such a case. We don't return such an error before these values hit max_int32 + 1.
I don't see any value in hardcoding such an additional limit, as these parameters are all bound by more restrictive values (tip_height, max_count=2016) before we even do any computation. So we still get an error in the same situation, but a different one.

Test Plan:
ninja check-functional

Check that the results and error messages are the same as the ones returned by Fulcrum (with the above mentionned minor difference)

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Thu, Jan 9, 17:26
PiRKPushed on Fri, Jan 10, 14:39
Reviewer
Restricted Project
Differential Revision
D17501: [chronik] implement electrum RPC blockchain.block.headers
Parents
rABCe5e3f1c17199: [mock-chronik-client] Update README
Branches
Unknown
Tags
Unknown