mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -25,10 +25,10 @@ use log::{info, trace, warn};
|
||||
use parity_util_mem::MallocSizeOf;
|
||||
use sc_client_api::{BlockchainEvents, UsageProvider};
|
||||
use sc_network::NetworkService;
|
||||
use sc_transaction_pool_api::TransactionPool;
|
||||
use sp_blockchain::HeaderMetadata;
|
||||
use sp_runtime::traits::{Block as BlockT, Header};
|
||||
use sc_transaction_pool_api::TransactionPool;
|
||||
use std::{fmt::Display, sync::Arc, time::Duration, collections::VecDeque};
|
||||
use std::{collections::VecDeque, fmt::Display, sync::Arc, time::Duration};
|
||||
|
||||
mod display;
|
||||
|
||||
@@ -48,9 +48,7 @@ pub struct OutputFormat {
|
||||
|
||||
impl Default for OutputFormat {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enable_color: true,
|
||||
}
|
||||
Self { enable_color: true }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +72,7 @@ pub async fn build<B: BlockT, C>(
|
||||
network: Arc<NetworkService<B, <B as BlockT>::Hash>>,
|
||||
pool: Arc<impl TransactionPoolAndMaybeMallogSizeOf>,
|
||||
format: OutputFormat,
|
||||
)
|
||||
where
|
||||
) where
|
||||
C: UsageProvider<B> + HeaderMetadata<B> + BlockchainEvents<B>,
|
||||
<C as HeaderMetadata<B>>::Error: Display,
|
||||
{
|
||||
@@ -131,19 +128,19 @@ where
|
||||
client.import_notification_stream().for_each(move |n| {
|
||||
// detect and log reorganizations.
|
||||
if let Some((ref last_num, ref last_hash)) = last_best {
|
||||
if n.header.parent_hash() != last_hash && n.is_new_best {
|
||||
let maybe_ancestor = sp_blockchain::lowest_common_ancestor(
|
||||
&*client,
|
||||
last_hash.clone(),
|
||||
n.hash,
|
||||
);
|
||||
if n.header.parent_hash() != last_hash && n.is_new_best {
|
||||
let maybe_ancestor =
|
||||
sp_blockchain::lowest_common_ancestor(&*client, last_hash.clone(), n.hash);
|
||||
|
||||
match maybe_ancestor {
|
||||
Ok(ref ancestor) if ancestor.hash != *last_hash => info!(
|
||||
"♻️ Reorg on #{},{} to #{},{}, common ancestor #{},{}",
|
||||
Colour::Red.bold().paint(format!("{}", last_num)), last_hash,
|
||||
Colour::Green.bold().paint(format!("{}", n.header.number())), n.hash,
|
||||
Colour::White.bold().paint(format!("{}", ancestor.number)), ancestor.hash,
|
||||
Colour::Red.bold().paint(format!("{}", last_num)),
|
||||
last_hash,
|
||||
Colour::Green.bold().paint(format!("{}", n.header.number())),
|
||||
n.hash,
|
||||
Colour::White.bold().paint(format!("{}", ancestor.number)),
|
||||
ancestor.hash,
|
||||
),
|
||||
Ok(_) => {},
|
||||
Err(e) => warn!("Error computing tree route: {}", e),
|
||||
@@ -155,7 +152,6 @@ where
|
||||
last_best = Some((n.header.number().clone(), n.hash.clone()));
|
||||
}
|
||||
|
||||
|
||||
// If we already printed a message for a given block recently,
|
||||
// we should not print it again.
|
||||
if !last_blocks.contains(&n.hash) {
|
||||
|
||||
Reference in New Issue
Block a user