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
@@ -31,7 +31,7 @@ use substrate_primitives::{ed25519::Public as AuthorityId, H256, Blake2Hasher};
use crate::{
AuthoritySignature, global_communication, CommandOrError, Config, environment,
Error, LinkHalf, Network, aux_schema::PersistentData, VoterCommand, VoterSetState,
LinkHalf, Network, aux_schema::PersistentData, VoterCommand, VoterSetState,
};
use crate::authorities::SharedAuthoritySet;
use crate::communication::NetworkBridge;
@@ -191,12 +191,7 @@ pub fn run_grandpa_observer<B, E, Block: BlockT<Hash=H256>, N, RA, SC>(
&network,
);
let chain_info = match client.info() {
Ok(i) => i,
Err(e) => return future::Either::B(future::err(Error::Client(e))),
};
let last_finalized_number = chain_info.chain.finalized_number;
let last_finalized_number = client.info().chain.finalized_number;
// create observer for the current set
let observer = grandpa_observer(
@@ -250,7 +245,7 @@ pub fn run_grandpa_observer<B, E, Block: BlockT<Hash=H256>, N, RA, SC>(
};
// run observer and listen to commands (switch authorities or pause)
future::Either::A(observer.select2(voter_commands_rx).then(move |res| match res {
observer.select2(voter_commands_rx).then(move |res| match res {
Ok(future::Either::A((_, _))) => {
// observer commit stream doesn't conclude naturally; this could reasonably be an error.
Ok(FutureLoop::Break(()))
@@ -275,7 +270,7 @@ pub fn run_grandpa_observer<B, E, Block: BlockT<Hash=H256>, N, RA, SC>(
// some command issued internally
handle_voter_command(command, voter_commands_rx)
},
}))
})
});
let observer_work = observer_work