Get block hash by its height

Create blockchain::GetBlockHash trait
with a method to get block hash given
a block height. Then, implement this
trait for all backends (Electrum, RPC
, Esplora, CBF). Referenced in issue 603.
This commit is contained in:
Vladimir Fomene
2022-06-16 20:42:02 +01:00
parent 1c94108d7e
commit 2af678aa84
9 changed files with 93 additions and 2 deletions

View File

@@ -169,6 +169,12 @@ impl GetHeight for RpcBlockchain {
}
}
impl GetBlockHash for RpcBlockchain {
fn get_block_hash(&self, height: u64) -> Result<BlockHash, Error> {
Ok(self.client.get_block_hash(height)?)
}
}
impl WalletSync for RpcBlockchain {
fn wallet_setup<D: BatchDatabase>(
&self,