From 575291206844883b00448a1e6264ac97d99bd7f8 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Fri, 15 Dec 2017 16:29:23 +0100 Subject: [PATCH] detect different node, same-key signing in aura (#7245) * detect different node, same-key signing in aura * reduce scope of warning --- ethcore/src/engines/authority_round/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index fa8d101a740..1405b393130 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -578,6 +578,7 @@ impl Engine for AuthorityRound { .expect("Header has been verified; qed").into(); let step = self.step.load(); + let expected_diff = calculate_score(parent_step, step.into()); if header.difficulty() != &expected_diff { @@ -617,6 +618,13 @@ impl Engine for AuthorityRound { }; if is_step_proposer(validators, header.parent_hash(), step, header.author()) { + // this is guarded against by `can_propose` unless the block was signed + // on the same step (implies same key) and on a different node. + if parent_step == step.into() { + warn!("Attempted to seal block on the same step as parent. Is this authority sealing with more than one node?"); + return Seal::None; + } + if let Ok(signature) = self.sign(header.bare_hash()) { trace!(target: "engine", "generate_seal: Issuing a block for step {}.", step);