Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: generated blocks in the connected state #1671

Merged
merged 2 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions test/src/specs/p2p/whitelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,5 @@ impl Spec for WhitelistOnSessionLimit {
if !is_connect_peer_num_eq_3 {
panic!("whitelist connect fail");
}

node1.disconnect(&node0);
// whitelist will be connected on inbound reach limit
node1.connect(&node0);

let is_connect_peer_num_eq_3 = wait_until(10, || {
let peers = rpc_client0.get_peers();
peers.len() == 3
&& peers
.into_iter()
.all(|node| id_set.contains(&node.node_id.as_str()))
});

if !is_connect_peer_num_eq_3 {
panic!("connect fail");
}
}
}
11 changes: 9 additions & 2 deletions test/src/specs/sync/ibd_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ impl Spec for IBDProcessWithWhiteList {
panic!("refuse to connect fail");
}

node6.disconnect(node0);
// After the whitelist is disconnected, it will always try to reconnect.
// In order to ensure that the node6 has already generated two blocks when reconnecting,
// it must be in the connected state, and then disconnected.
node6.generate_blocks(2);

let generate_res = wait_until(10, || net.nodes[6].get_tip_block_number() == 2);
Expand All @@ -147,7 +149,12 @@ impl Spec for IBDProcessWithWhiteList {
panic!("node6 can't generate blocks to 2");
}

node0.connect_uncheck(node6);
// Although the disconnection of the whitelist is automatically reconnected for node0,
// the disconnect operation is still needed here to instantly refresh the state of node6 in node0.
node6.disconnect(node0);

// Make sure node0 re-connect with node6
node0.connect(node6);

// IBD only with outbound/whitelist node
let rpc_client1 = node1.rpc_client();
Expand Down