fix tests

This commit is contained in:
keorn 2016-11-30 16:40:16 +00:00
parent d128c20dc2
commit dbf82c2e98
2 changed files with 9 additions and 10 deletions

View File

@ -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);
}

View File

@ -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<Step> 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<Step> for TransitionHandler {
engine.reset_round();
Some(Step::Propose)
},
_ => None,
};
if let Some(step) = next_step {