Skip to content

Commit 2ab61d0

Browse files
committed
Merge #204: Reduce duplication using conditional initialization in addnode test
a2e2092 Reduce duplication using conditional initialization in addnode test (GideonBature) Pull request description: This is done to reduce the duplication of code in the add_node test. It is also done to maintain consistency with existing tests already using such approach. ACKs for top commit: tcharding: ACK a2e2092 Tree-SHA512: d64ba3caea2158d3932457ad6a361a40a81033f3e0ccbd63347bacc8abaa48179ecb95b75f5a30e9c761baa11259f00a72e9f719edc48eb30f1aba0c94fd12c4
2 parents 8f3914c + a2e2092 commit 2ab61d0

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

integration_test/tests/network.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,18 @@ use node::{AddNodeCommand, mtype, SetBanCommand};
1010

1111
#[test]
1212
fn network__add_node() {
13-
let dummy_peer = "192.0.2.1:8333";
13+
let node = match () {
14+
#[cfg(feature = "v25_and_below")]
15+
() => Node::with_wallet(Wallet::None, &[]),
16+
#[cfg(not(feature = "v25_and_below"))]
17+
() => Node::with_wallet(Wallet::None, &["-v2transport"]),
18+
};
1419

15-
#[cfg(feature = "v25_and_below")]
16-
{
17-
let node = Node::with_wallet(Wallet::None, &[]);
18-
node.client.add_node(dummy_peer, AddNodeCommand::OneTry).expect("addnode onetry");
19-
node.client.add_node(dummy_peer, AddNodeCommand::Add).expect("addnode add");
20-
node.client.add_node(dummy_peer, AddNodeCommand::Remove).expect("addnode remove");
21-
}
20+
let dummy_peer = "192.0.2.1:8333";
2221

23-
#[cfg(not(feature = "v25_and_below"))]
24-
{
25-
let node = Node::with_wallet(Wallet::None, &["-v2transport"]);
26-
node.client.add_node(dummy_peer, AddNodeCommand::OneTry).expect("addnode onetry");
27-
node.client.add_node(dummy_peer, AddNodeCommand::Add).expect("addnode add");
28-
node.client.add_node(dummy_peer, AddNodeCommand::Remove).expect("addnode remove");
29-
}
22+
node.client.add_node(dummy_peer, AddNodeCommand::OneTry).expect("addnode onetry");
23+
node.client.add_node(dummy_peer, AddNodeCommand::Add).expect("addnode add");
24+
node.client.add_node(dummy_peer, AddNodeCommand::Remove).expect("addnode remove");
3025
}
3126

3227
#[test]

0 commit comments

Comments
 (0)