client: only report block import to telemetry if new best (#3548)

* client: only report block import to telemetry if new best

* grandpa: fix tests

* consensus: derive Default for ImportedAux

* network: fix test
This commit is contained in:
André Silva
2019-09-04 17:14:42 +01:00
committed by GitHub
parent c6f3798078
commit 397855c611
5 changed files with 40 additions and 29 deletions
+14 -10
View File
@@ -879,11 +879,15 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
fork_choice,
);
telemetry!(SUBSTRATE_INFO; "block.import";
"height" => height,
"best" => ?hash,
"origin" => ?origin
);
if let Ok(ImportResult::Imported(ref aux)) = result {
if aux.is_new_best {
telemetry!(SUBSTRATE_INFO; "block.import";
"height" => height,
"best" => ?hash,
"origin" => ?origin
);
}
}
result
}
@@ -985,7 +989,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
operation.notify_imported = Some((hash, origin, import_headers.into_post(), is_new_best, storage_changes));
}
Ok(ImportResult::imported())
Ok(ImportResult::imported(is_new_best))
}
fn block_execution(
@@ -1500,7 +1504,7 @@ impl<'a, B, E, Block, RA> consensus::BlockImport<Block> for &'a Client<B, E, Blo
BlockStatus::KnownBad => return Ok(ImportResult::KnownBad),
}
Ok(ImportResult::imported())
Ok(ImportResult::imported(false))
}
}
@@ -1528,7 +1532,7 @@ impl<B, E, Block, RA> consensus::BlockImport<Block> for Client<B, E, Block, RA>
}
}
impl<B, E, Block, RA> Finalizer<Block, Blake2Hasher, B> for Client<B, E, Block, RA> where
impl<B, E, Block, RA> Finalizer<Block, Blake2Hasher, B> for Client<B, E, Block, RA> where
B: backend::Backend<Block, Blake2Hasher>,
E: CallExecutor<Block, Blake2Hasher>,
Block: BlockT<Hash=H256>,
@@ -1552,7 +1556,7 @@ impl<B, E, Block, RA> Finalizer<Block, Blake2Hasher, B> for Client<B, E, Block,
}
}
impl<B, E, Block, RA> Finalizer<Block, Blake2Hasher, B> for &Client<B, E, Block, RA> where
impl<B, E, Block, RA> Finalizer<Block, Blake2Hasher, B> for &Client<B, E, Block, RA> where
B: backend::Backend<Block, Blake2Hasher>,
E: CallExecutor<Block, Blake2Hasher>,
Block: BlockT<Hash=H256>,
@@ -1833,7 +1837,7 @@ impl<B, E, Block, RA> backend::AuxStore for &Client<B, E, Block, RA>
B: backend::Backend<Block, Blake2Hasher>,
E: CallExecutor<Block, Blake2Hasher>,
Block: BlockT<Hash=H256>,
{
{
fn insert_aux<
'a,