From dbf82c2e98e8ce13d6ef358c93c822a2bd48ef03 Mon Sep 17 00:00:00 2001 From: keorn Date: Wed, 30 Nov 2016 16:40:16 +0000 Subject: [PATCH] fix tests --- ethcore/src/engines/tendermint/mod.rs | 9 +++++---- ethcore/src/engines/tendermint/transition.rs | 10 ++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index e7eb486dc..e8b4973fe 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -647,7 +647,7 @@ mod tests { let engine = spec.engine; let mut header = Header::default(); - let proposer = insert_and_unlock(&tap, "0"); + let proposer = insert_and_unlock(&tap, "1"); header.set_author(proposer); let mut seal = proposal_seal(&tap, &header, 0); @@ -687,6 +687,7 @@ mod tests { #[test] fn step_transitioning() { + ::env_logger::init().unwrap(); let (spec, tap) = setup(); let engine = spec.engine.clone(); let mut db_result = get_temp_state_db(); @@ -717,11 +718,11 @@ mod tests { vote(&engine, |mh| tap.sign(v0, None, mh).ok().map(H520::from), h, r, Step::Precommit, proposal); // Wait a bit for async stuff. - ::std::thread::sleep(::std::time::Duration::from_millis(500)); + ::std::thread::sleep(::std::time::Duration::from_millis(50)); seal[2] = precommit_signatures(&tap, h, r, Some(b.header().bare_hash()), v0, v1); - let first = test_io.received.read()[5] == ClientIoMessage::SubmitSeal(proposal.unwrap(), seal.clone()); + let first = test_io.received.read().contains(&ClientIoMessage::SubmitSeal(proposal.unwrap(), seal.clone())); seal[2] = precommit_signatures(&tap, h, r, Some(b.header().bare_hash()), v1, v0); - let second = test_io.received.read()[5] == ClientIoMessage::SubmitSeal(proposal.unwrap(), seal); + let second = test_io.received.read().contains(&ClientIoMessage::SubmitSeal(proposal.unwrap(), seal)); assert!(first ^ second); } diff --git a/ethcore/src/engines/tendermint/transition.rs b/ethcore/src/engines/tendermint/transition.rs index b20b97fba..a7aebfd30 100644 --- a/ethcore/src/engines/tendermint/transition.rs +++ b/ethcore/src/engines/tendermint/transition.rs @@ -49,9 +49,9 @@ impl Default for TendermintTimeouts { fn default() -> Self { TendermintTimeouts { propose: Duration::milliseconds(2000), - prevote: Duration::milliseconds(1000), - precommit: Duration::milliseconds(1000), - commit: Duration::milliseconds(1000) + prevote: Duration::milliseconds(2000), + precommit: Duration::milliseconds(2000), + commit: Duration::milliseconds(2000) } } } @@ -99,8 +99,7 @@ impl IoHandler for TransitionHandler { Step::Precommit => { trace!(target: "poa", "timeout: Precommit timeout without enough votes."); set_timeout(io, engine.our_params.timeouts.propose); - engine.increment_round(1); - Some(Step::Propose) + Some(Step::Precommit) }, Step::Commit => { trace!(target: "poa", "timeout: Commit timeout."); @@ -108,7 +107,6 @@ impl IoHandler for TransitionHandler { engine.reset_round(); Some(Step::Propose) }, - _ => None, }; if let Some(step) = next_step {