chain-api subsystem: implement BlockHeader messsage (#1778)

* chain-api subsystem: implement BlockHeader messsage

* update the guide
This commit is contained in:
Andronik Ordian
2020-10-06 16:46:54 +02:00
committed by GitHub
parent abf76d27dc
commit d00bdfef08
4 changed files with 48 additions and 8 deletions
@@ -14,6 +14,7 @@ On receipt of `ChainApiMessage`, answer the request and provide the response to
Currently, the following requests are supported:
* Block hash to number
* Block hash to header
* Finalized block number to hash
* Last finalized block number
* Ancestors
@@ -140,6 +140,9 @@ enum ChainApiMessage {
/// Get the block number by hash.
/// Returns `None` if a block with the given hash is not present in the db.
BlockNumber(Hash, ResponseChannel<Result<Option<BlockNumber>, Error>>),
/// Request the block header by hash.
/// Returns `None` if a block with the given hash is not present in the db.
BlockHeader(Hash, ResponseChannel<Result<Option<BlockHeader>, Error>>),
/// Get the finalized block hash by number.
/// Returns `None` if a block with the given number is not present in the db.
/// Note: the caller must ensure the block is finalized.