mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +00:00
Client::info() no longer returns a Result (#2776)
This commit is contained in:
committed by
Bastian Köcher
parent
53e8ad8728
commit
5df89a8a6f
@@ -52,7 +52,7 @@ pub fn export_blocks<F, E, W>(
|
||||
let last = match to {
|
||||
Some(v) if v.is_zero() => One::one(),
|
||||
Some(v) => v,
|
||||
None => client.info()?.chain.best_number,
|
||||
None => client.info().chain.best_number,
|
||||
};
|
||||
|
||||
if last < block {
|
||||
@@ -186,7 +186,7 @@ pub fn import_blocks<F, E, R>(
|
||||
blocks_imported += 1;
|
||||
}
|
||||
|
||||
info!("Imported {} blocks. Best: #{}", block_count, client.info()?.chain.best_number);
|
||||
info!("Imported {} blocks. Best: #{}", block_count, client.info().chain.best_number);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -200,7 +200,7 @@ pub fn revert_chain<F>(
|
||||
{
|
||||
let client = new_client::<F>(&config)?;
|
||||
let reverted = client.revert(blocks)?;
|
||||
let info = client.info()?.chain;
|
||||
let info = client.info().chain;
|
||||
|
||||
if reverted.is_zero() {
|
||||
info!("There aren't any non-finalized blocks to revert.");
|
||||
|
||||
@@ -156,7 +156,7 @@ impl<Components: components::Components> Service<Components> {
|
||||
select_chain.clone(),
|
||||
)?);
|
||||
let finality_proof_provider = Components::build_finality_proof_provider(client.clone())?;
|
||||
let chain_info = client.info()?.chain;
|
||||
let chain_info = client.info().chain;
|
||||
|
||||
let version = config.full_version();
|
||||
info!("Highest known block at #{}", chain_info.best_number);
|
||||
@@ -479,12 +479,7 @@ pub struct TransactionPoolAdapter<C: Components> {
|
||||
|
||||
impl<C: Components> TransactionPoolAdapter<C> {
|
||||
fn best_block_id(&self) -> Option<BlockId<ComponentBlock<C>>> {
|
||||
self.client.info()
|
||||
.map(|info| BlockId::hash(info.chain.best_hash))
|
||||
.map_err(|e| {
|
||||
debug!("Error getting best block: {:?}", e);
|
||||
})
|
||||
.ok()
|
||||
Some(BlockId::hash(self.client.info().chain.best_hash))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -250,11 +250,11 @@ where
|
||||
service.network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer");
|
||||
}
|
||||
network.run_until_all_full(|_index, service|
|
||||
service.client().info().unwrap().chain.best_number == NUM_BLOCKS.into()
|
||||
service.client().info().chain.best_number == NUM_BLOCKS.into()
|
||||
);
|
||||
info!("Checking extrinsic propagation");
|
||||
let first_service = network.full_nodes[0].1.clone();
|
||||
let best_block = BlockId::number(first_service.client().info().unwrap().chain.best_number);
|
||||
let best_block = BlockId::number(first_service.client().info().chain.best_number);
|
||||
first_service.transaction_pool().submit_one(&best_block, extrinsic_factory(&first_service)).unwrap();
|
||||
network.run_until_all_full(|_index, service|
|
||||
service.transaction_pool().ready().count() == 1
|
||||
@@ -278,7 +278,7 @@ pub fn consensus<F>(spec: FactoryChainSpec<F>, authorities: Vec<String>)
|
||||
service.network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer");
|
||||
}
|
||||
network.run_until_all_full(|_index, service| {
|
||||
service.client().info().unwrap().chain.finalized_number >= (NUM_BLOCKS / 2).into()
|
||||
service.client().info().chain.finalized_number >= (NUM_BLOCKS / 2).into()
|
||||
});
|
||||
info!("Adding more peers");
|
||||
network.insert_nodes(&temp, NUM_NODES / 2, 0, vec![]);
|
||||
@@ -286,6 +286,6 @@ pub fn consensus<F>(spec: FactoryChainSpec<F>, authorities: Vec<String>)
|
||||
service.network().add_reserved_peer(first_address.to_string()).expect("Error adding reserved peer");
|
||||
}
|
||||
network.run_until_all_full(|_index, service|
|
||||
service.client().info().unwrap().chain.finalized_number >= NUM_BLOCKS.into()
|
||||
service.client().info().chain.finalized_number >= NUM_BLOCKS.into()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user