Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 29fc69b

Browse files
author
Andronik Ordian
committed
fix Tendermint extra_info: allow non-proposal messages
1 parent dd2c279 commit 29fc69b

File tree

1 file changed

+7
-5
lines changed
  • ethcore/src/engines/tendermint

1 file changed

+7
-5
lines changed

ethcore/src/engines/tendermint/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,12 @@ impl Engine<EthereumMachine> for Tendermint {
451451

452452
/// Additional engine-specific information for the user/developer concerning `header`.
453453
fn extra_info(&self, header: &Header) -> BTreeMap<String, String> {
454-
let message = ConsensusMessage::new_proposal(header).expect("Invalid header.");
454+
let view = consensus_view(header).expect("Invalid header view.");
455+
let height = header.number() as Height;
455456
map![
456-
"signature".into() => message.signature.to_string(),
457-
"height".into() => message.vote_step.height.to_string(),
458-
"view".into() => message.vote_step.view.to_string(),
459-
"block_hash".into() => message.block_hash.as_ref().map(ToString::to_string).unwrap_or("".into())
457+
"height".into() => height.to_string(),
458+
"view".into() => view.to_string(),
459+
"block_hash".into() => header.bare_hash().to_string()
460460
]
461461
}
462462

@@ -945,6 +945,8 @@ mod tests {
945945
seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone()), H520::from(signature0.clone())]).into_vec();
946946
header.set_seal(seal.clone());
947947

948+
engine.extra_info(&header);
949+
948950
assert!(engine.verify_block_external(&header).is_ok());
949951

950952
let bad_voter = insert_and_unlock(&tap, "101");

0 commit comments

Comments
 (0)