Skip to content

Commit d561e5c

Browse files
committed
Explicitly check type of GetPeerInfo vector element
The `GetPeerInfo` type wraps a vector of `PeerInfo` types. In such circumstances when we re-export the outer type super easy to either forget to re-export the inner type. Currently most of our tests only test the outer type. Add a local variable assignment that explicitly uses the inner type, there by proving all the re-exports are correct. Tested by running v21 tests _without_ the re-export bug found in review. And indeed this new test finds it.
1 parent 8a26cd0 commit d561e5c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

integration_test/tests/network.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ fn get_peer_info_three_node_network() {
107107
node2.mine_a_block();
108108
node3.mine_a_block();
109109

110+
let json: GetPeerInfo = node1.client.get_peer_info().expect("getpeerinfo");
111+
// This verifies that we re-exported the correct `PeerInfo` type at the module level.
112+
let _: PeerInfo = json.0[0];
113+
110114
// FIXME: Fails if we use equal to 2 ???
111115
assert!(node1.peers_connected() >= 1);
112116
assert!(node2.peers_connected() >= 1);

0 commit comments

Comments
 (0)