mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 14:35:40 +00:00
Refactor to use only chain info (#4516)
This commit is contained in:
committed by
Bastian Köcher
parent
8ecc450fd9
commit
6d06a19f41
@@ -766,7 +766,7 @@ ServiceBuilder<
|
||||
|
||||
sp_session::generate_initial_session_keys(
|
||||
client.clone(),
|
||||
&BlockId::Hash(client.info().chain.best_hash),
|
||||
&BlockId::Hash(client.chain_info().best_hash),
|
||||
config.dev_key_seed.clone().map(|s| vec![s]).unwrap_or_default(),
|
||||
)?;
|
||||
|
||||
@@ -780,7 +780,7 @@ ServiceBuilder<
|
||||
let (essential_failed_tx, essential_failed_rx) = mpsc::unbounded();
|
||||
|
||||
let import_queue = Box::new(import_queue);
|
||||
let chain_info = client.info().chain;
|
||||
let chain_info = client.chain_info();
|
||||
|
||||
let version = config.full_version();
|
||||
info!("Highest known block at #{}", chain_info.best_number);
|
||||
@@ -916,7 +916,7 @@ ServiceBuilder<
|
||||
let (state_tx, state_rx) = mpsc::unbounded::<(NetworkStatus<_>, NetworkState)>();
|
||||
network_status_sinks.lock().push(std::time::Duration::from_millis(5000), state_tx);
|
||||
let tel_task = state_rx.for_each(move |(net_status, _)| {
|
||||
let info = client_.info();
|
||||
let info = client_.usage_info();
|
||||
let best_number = info.chain.best_number.saturated_into::<u64>();
|
||||
let best_hash = info.chain.best_hash;
|
||||
let num_peers = net_status.num_connected_peers;
|
||||
|
||||
@@ -198,7 +198,7 @@ impl<
|
||||
}
|
||||
|
||||
if link.imported_blocks >= count {
|
||||
info!("Imported {} blocks. Best: #{}", read_block_count, client.info().chain.best_number);
|
||||
info!("Imported {} blocks. Best: #{}", read_block_count, client.chain_info().best_number);
|
||||
return std::task::Poll::Ready(Ok(()));
|
||||
|
||||
} else {
|
||||
@@ -222,7 +222,7 @@ impl<
|
||||
let last = match to {
|
||||
Some(v) if v.is_zero() => One::one(),
|
||||
Some(v) => v,
|
||||
None => client.info().chain.best_number,
|
||||
None => client.chain_info().best_number,
|
||||
};
|
||||
|
||||
let mut wrote_header = false;
|
||||
@@ -283,7 +283,7 @@ impl<
|
||||
blocks: NumberFor<TBl>
|
||||
) -> Result<(), Error> {
|
||||
let reverted = self.client.revert(blocks)?;
|
||||
let info = self.client.info().chain;
|
||||
let info = self.client.chain_info();
|
||||
|
||||
if reverted.is_zero() {
|
||||
info!("There aren't any non-finalized blocks to revert.");
|
||||
|
||||
@@ -684,7 +684,7 @@ where
|
||||
let encoded = transaction.encode();
|
||||
match Decode::decode(&mut &encoded[..]) {
|
||||
Ok(uxt) => {
|
||||
let best_block_id = BlockId::hash(self.client.info().chain.best_hash);
|
||||
let best_block_id = BlockId::hash(self.client.info().best_hash);
|
||||
let import_future = self.pool.submit_one(&best_block_id, uxt);
|
||||
let import_future = import_future
|
||||
.then(move |import_result| {
|
||||
|
||||
@@ -446,15 +446,15 @@ pub fn sync<G, E, Fb, F, Lb, L, B, ExF, U>(
|
||||
}
|
||||
network.run_until_all_full(
|
||||
|_index, service|
|
||||
service.get().client().info().chain.best_number == (NUM_BLOCKS as u32).into(),
|
||||
service.get().client().chain_info().best_number == (NUM_BLOCKS as u32).into(),
|
||||
|_index, service|
|
||||
service.get().client().info().chain.best_number == (NUM_BLOCKS as u32).into(),
|
||||
service.get().client().chain_info().best_number == (NUM_BLOCKS as u32).into(),
|
||||
);
|
||||
|
||||
info!("Checking extrinsic propagation");
|
||||
let first_service = network.full_nodes[0].1.clone();
|
||||
let first_user_data = &network.full_nodes[0].2;
|
||||
let best_block = BlockId::number(first_service.get().client().info().chain.best_number);
|
||||
let best_block = BlockId::number(first_service.get().client().chain_info().best_number);
|
||||
let extrinsic = extrinsic_factory(&first_service.get(), first_user_data);
|
||||
futures03::executor::block_on(first_service.get().transaction_pool().submit_one(&best_block, extrinsic)).unwrap();
|
||||
network.run_until_all_full(
|
||||
@@ -501,9 +501,9 @@ pub fn consensus<G, E, Fb, F, Lb, L>(
|
||||
}
|
||||
network.run_until_all_full(
|
||||
|_index, service|
|
||||
service.get().client().info().chain.finalized_number >= (NUM_BLOCKS as u32 / 2).into(),
|
||||
service.get().client().chain_info().finalized_number >= (NUM_BLOCKS as u32 / 2).into(),
|
||||
|_index, service|
|
||||
service.get().client().info().chain.best_number >= (NUM_BLOCKS as u32 / 2).into(),
|
||||
service.get().client().chain_info().best_number >= (NUM_BLOCKS as u32 / 2).into(),
|
||||
);
|
||||
|
||||
info!("Adding more peers");
|
||||
@@ -523,8 +523,8 @@ pub fn consensus<G, E, Fb, F, Lb, L>(
|
||||
}
|
||||
network.run_until_all_full(
|
||||
|_index, service|
|
||||
service.get().client().info().chain.finalized_number >= (NUM_BLOCKS as u32).into(),
|
||||
service.get().client().chain_info().finalized_number >= (NUM_BLOCKS as u32).into(),
|
||||
|_index, service|
|
||||
service.get().client().info().chain.best_number >= (NUM_BLOCKS as u32).into(),
|
||||
service.get().client().chain_info().best_number >= (NUM_BLOCKS as u32).into(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user