more mocknet tests
This commit is contained in:
parent
ec058cdb50
commit
cf88641f99
@ -24,10 +24,23 @@ use ethcore::client::BlockChainClient;
|
|||||||
fn authorities() -> Vec<H256> { vec!["1".sha3(), "2".sha3()] }
|
fn authorities() -> Vec<H256> { vec!["1".sha3(), "2".sha3()] }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn three_peer_tx_seal() {
|
fn two_auth() {
|
||||||
::env_logger::init().ok();
|
::env_logger::init().ok();
|
||||||
let mut net = MockNet::new_with_spec(2, authorities(), &Spec::new_test_round);
|
let mut net = MockNet::new_with_spec(2, authorities(), &Spec::new_test_round);
|
||||||
net.peer(1).issue_rand_tx();
|
net.peer(1).issue_rand_tx();
|
||||||
|
net.sync();
|
||||||
|
sleep(Duration::from_secs(1));
|
||||||
|
net.sync();
|
||||||
|
println!("{:?}", net.peer(0).client.chain_info());
|
||||||
|
println!("{:?}", net.peer(1).client.chain_info());
|
||||||
|
net.is_synced(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn one_auth_missing() {
|
||||||
|
::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();
|
||||||
sleep(Duration::from_secs(1));
|
sleep(Duration::from_secs(1));
|
||||||
net.sync();
|
net.sync();
|
||||||
sleep(Duration::from_secs(1));
|
sleep(Duration::from_secs(1));
|
||||||
|
@ -325,7 +325,6 @@ impl MockNet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_synced(&self, block: BlockNumber) {
|
pub fn is_synced(&self, block: BlockNumber) {
|
||||||
println!("Is block {:?}", &block);
|
|
||||||
let hash = self.peer(0).client.chain_info().best_block_hash;
|
let hash = self.peer(0).client.chain_info().best_block_hash;
|
||||||
for p in &self.peers {
|
for p in &self.peers {
|
||||||
let ci = p.client.chain_info();
|
let ci = p.client.chain_info();
|
||||||
|
Loading…
Reference in New Issue
Block a user