Client::info() no longer returns a Result (#2776)

This commit is contained in:
Pierre Krieger
2019-06-04 16:09:46 +02:00
committed by Bastian Köcher
parent 53e8ad8728
commit 5df89a8a6f
33 changed files with 235 additions and 274 deletions
+4 -4
View File
@@ -124,7 +124,7 @@ impl<B, E, Block, RA> Chain<B, E, Block, RA> where
{
fn unwrap_or_best(&self, hash: Option<Block::Hash>) -> Result<Block::Hash> {
Ok(match hash.into() {
None => self.client.info()?.chain.best_hash,
None => self.client.info().chain.best_hash,
Some(hash) => hash,
})
}
@@ -188,13 +188,13 @@ impl<B, E, Block, RA> ChainApi<NumberFor<Block>, Block::Hash, Block::Header, Sig
fn block_hash(&self, number: Option<number::NumberOrHex<NumberFor<Block>>>) -> Result<Option<Block::Hash>> {
Ok(match number {
None => Some(self.client.info()?.chain.best_hash),
None => Some(self.client.info().chain.best_hash),
Some(num_or_hex) => self.client.header(&BlockId::number(num_or_hex.to_number()?))?.map(|h| h.hash()),
})
}
fn finalized_head(&self) -> Result<Block::Hash> {
Ok(self.client.info()?.chain.finalized_hash)
Ok(self.client.info().chain.finalized_hash)
}
fn subscribe_new_head(&self, _metadata: Self::Metadata, subscriber: Subscriber<Block::Header>) {
@@ -214,7 +214,7 @@ impl<B, E, Block, RA> ChainApi<NumberFor<Block>, Block::Hash, Block::Header, Sig
fn subscribe_finalized_heads(&self, _meta: Self::Metadata, subscriber: Subscriber<Block::Header>) {
self.subscribe_headers(
subscriber,
|| Ok(Some(self.client.info()?.chain.finalized_hash)),
|| Ok(Some(self.client.info().chain.finalized_hash)),
|| self.client.finality_notification_stream()
.map(|notification| notification.header),
)