mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 10:57:56 +00:00
Update import metrics and add verification time (#6170)
* refactor import reporting and add time * Update primitives/consensus/common/src/metrics.rs Co-authored-by: Max Inden <mail@max-inden.de> * remove (crate) * fix longer lines * swap names to avoid api breaking Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@@ -55,7 +55,11 @@ fn import_single_good_block_works() {
|
||||
let mut expected_aux = ImportedAux::default();
|
||||
expected_aux.is_new_best = true;
|
||||
|
||||
match import_single_block(&mut substrate_test_runtime_client::new(), BlockOrigin::File, block, &mut PassThroughVerifier(true)) {
|
||||
match import_single_block(
|
||||
&mut substrate_test_runtime_client::new(),
|
||||
BlockOrigin::File, block,
|
||||
&mut PassThroughVerifier(true),
|
||||
) {
|
||||
Ok(BlockImportResult::ImportedUnknown(ref num, ref aux, ref org))
|
||||
if *num == number && *aux == expected_aux && *org == Some(peer_id) => {}
|
||||
r @ _ => panic!("{:?}", r)
|
||||
@@ -65,7 +69,11 @@ fn import_single_good_block_works() {
|
||||
#[test]
|
||||
fn import_single_good_known_block_is_ignored() {
|
||||
let (mut client, _hash, number, _, block) = prepare_good_block();
|
||||
match import_single_block(&mut client, BlockOrigin::File, block, &mut PassThroughVerifier(true)) {
|
||||
match import_single_block(
|
||||
&mut client, BlockOrigin::File,
|
||||
block,
|
||||
&mut PassThroughVerifier(true)
|
||||
) {
|
||||
Ok(BlockImportResult::ImportedKnown(ref n)) if *n == number => {}
|
||||
_ => panic!()
|
||||
}
|
||||
@@ -75,7 +83,11 @@ fn import_single_good_known_block_is_ignored() {
|
||||
fn import_single_good_block_without_header_fails() {
|
||||
let (_, _, _, peer_id, mut block) = prepare_good_block();
|
||||
block.header = None;
|
||||
match import_single_block(&mut substrate_test_runtime_client::new(), BlockOrigin::File, block, &mut PassThroughVerifier(true)) {
|
||||
match import_single_block(
|
||||
&mut substrate_test_runtime_client::new(),
|
||||
BlockOrigin::File, block,
|
||||
&mut PassThroughVerifier(true),
|
||||
) {
|
||||
Err(BlockImportError::IncompleteHeader(ref org)) if *org == Some(peer_id) => {}
|
||||
_ => panic!()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user