Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Properly log sealing and the newly created proposal hash from aura
  • Loading branch information
gnunicorn committed Jan 11, 2019
commit 6207af2ec46937db76c9e2ee20e482340035ffe6
19 changes: 10 additions & 9 deletions core/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,16 @@ impl<Block, C, A> Proposer<Block, C, A> where
self.transaction_pool.remove_invalid(&unqueue_invalid);
})?;

info!("Proposing block [number: {}; hash: {}; parent_hash: {}; extrinsics: [{}]]",
block.header().number(),
<<C as AuthoringApi>::Block as BlockT>::Hash::from(block.header().hash()),
block.header().parent_hash(),
block.extrinsics().iter()
.map(|xt| format!("{}", BlakeTwo256::hash_of(xt)))
.collect::<Vec<_>>()
.join(", ")
);
info!("Prepared block for proposing at {} [hash: {:?}; parent_hash: {}; extrinsics: [{}]]",
block.header().number(),
<<C as AuthoringApi>::Block as BlockT>::Hash::from(block.header().hash()),
block.header().parent_hash(),
block.extrinsics()
.iter()
.map(|xt| format!("{}", BlakeTwo256::hash_of(xt)))
.collect::<Vec<_>>()
.join(", ")
);

let substrate_block = Decode::decode(&mut block.encode().as_slice())
.expect("blocks are defined to serialize to substrate blocks correctly; qed");
Expand Down
9 changes: 8 additions & 1 deletion core/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ pub fn start_aura<B, C, E, I, SO, Error>(
}

let (header, body) = b.deconstruct();
let header_num = header.number().clone();
let pre_hash = header.hash();
let parent_hash = header.parent_hash().clone();

Expand All @@ -316,7 +317,7 @@ pub fn start_aura<B, C, E, I, SO, Error>(
signature,
);

let import_block = ImportBlock {
let import_block : ImportBlock<B> = ImportBlock {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style:

Suggested change
let import_block : ImportBlock<B> = ImportBlock {
let import_block: ImportBlock<B> = ImportBlock {

origin: BlockOrigin::Own,
header,
justification: None,
Expand All @@ -327,6 +328,12 @@ pub fn start_aura<B, C, E, I, SO, Error>(
fork_choice: ForkChoiceStrategy::LongestChain,
};

info!("Pre-sealed block for proposal at {}. Hash now {:?}, previously {:?}.",
header_num,
import_block.post_header().hash(),
pre_hash
);

if let Err(e) = block_import.import_block(import_block, None) {
warn!(target: "aura", "Error with block built on {:?}: {:?}",
parent_hash, e);
Expand Down