Refactor to use only chain info (#4516)

This commit is contained in:
Nikolay Volf
2020-01-02 14:46:07 +03:00
committed by Bastian Köcher
parent 8ecc450fd9
commit 6d06a19f41
30 changed files with 178 additions and 175 deletions
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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.");
+1 -1
View File
@@ -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| {