mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
more logging around pending GRANDPA changes (#1587)
This commit is contained in:
committed by
Gav Wood
parent
f16ddcb622
commit
86c5f78805
@@ -1568,6 +1568,28 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tree_route_child() {
|
||||
let backend = Backend::<Block>::new_test(1000, 100);
|
||||
|
||||
let block0 = insert_header(&backend, 0, Default::default(), Vec::new(), Default::default());
|
||||
let block1 = insert_header(&backend, 1, block0, Vec::new(), Default::default());
|
||||
|
||||
{
|
||||
let tree_route = ::client::blockchain::tree_route(
|
||||
backend.blockchain(),
|
||||
BlockId::Hash(block0),
|
||||
BlockId::Hash(block1),
|
||||
).unwrap();
|
||||
|
||||
println!("{:?}", tree_route);
|
||||
|
||||
assert_eq!(tree_route.common_block().hash, block0);
|
||||
assert!(tree_route.retracted().is_empty());
|
||||
assert_eq!(tree_route.enacted().iter().map(|r| r.hash).collect::<Vec<_>>(), vec![block1]);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_leaves_with_complex_block_tree() {
|
||||
let backend: Arc<Backend<test_client::runtime::Block>> = Arc::new(Backend::new_test(20, 20));
|
||||
|
||||
@@ -140,8 +140,13 @@ where
|
||||
))
|
||||
.unwrap_or_else(|i| i);
|
||||
|
||||
debug!(target: "afg", "Inserting potential set change at block {:?}.",
|
||||
(&pending.canon_height, &pending.canon_hash));
|
||||
|
||||
self.pending_changes.insert(idx, pending);
|
||||
|
||||
debug!(target: "afg", "There are now {} pending changes.", self.pending_changes.len());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -1136,6 +1136,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA, PRA> BlockImport<Block>
|
||||
|
||||
let is_equal_or_descendent_of = |base: &Block::Hash| -> Result<(), ConsensusError> {
|
||||
let error = || {
|
||||
debug!(target: "afg", "rejecting change: {} is in the same chain as {}", hash, base);
|
||||
Err(ConsensusErrorKind::ClientImport("Incorrect base hash".to_string()).into())
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user