From ce3e8750c97e7654ce2cbe4fa092b9b5f7a82653 Mon Sep 17 00:00:00 2001 From: keorn Date: Mon, 19 Sep 2016 14:33:11 +0200 Subject: [PATCH] additional consensus test --- ethcore/src/engines/authority_round.rs | 3 +-- sync/src/tests/consensus.rs | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ethcore/src/engines/authority_round.rs b/ethcore/src/engines/authority_round.rs index 2984ef263..dc388da6b 100644 --- a/ethcore/src/engines/authority_round.rs +++ b/ethcore/src/engines/authority_round.rs @@ -161,8 +161,7 @@ impl Engine for AuthorityRound { fn is_sealer(&self, author: &Address) -> Option { let ref p = self.our_params; - Some(p.authorities.contains(author)); - Some(true) + Some(p.authorities.contains(author)) } /// Attempt to seal the block internally. diff --git a/sync/src/tests/consensus.rs b/sync/src/tests/consensus.rs index db0b7d646..72109893b 100644 --- a/sync/src/tests/consensus.rs +++ b/sync/src/tests/consensus.rs @@ -28,10 +28,32 @@ fn issue_tx() { net.peer(1).issue_rand_tx(); sleep(Duration::from_secs(1)); net.sync(); - sleep(Duration::from_secs(1)); net.sync(); net.sync(); net.sync(); println!("{:?}", net.peer(0).client.chain_info()); println!("{:?}", net.peer(1).client.chain_info()); } + +#[test] +fn issue_many() { + ::env_logger::init().ok(); + let mut net = MockNet::new_with_spec(2, vec!["1".sha3()], &Spec::new_test_round); + net.peer(1).issue_rand_tx(); + net.peer(1).issue_rand_tx(); + net.peer(1).issue_rand_tx(); + net.peer(1).issue_rand_tx(); + net.peer(1).issue_rand_tx(); + sleep(Duration::from_secs(1)); + net.sync(); + net.sync(); + net.peer(0).issue_rand_tx(); + net.peer(0).issue_rand_tx(); + net.peer(0).issue_rand_tx(); + net.peer(0).issue_rand_tx(); + net.peer(0).issue_rand_tx(); + net.sync(); + net.sync(); + //println!("{:?}", net.peer(0).client.chain_info()); + //println!("{:?}", net.peer(1).client.chain_info()); +}