Skip to content

Commit 345169a

Browse files
committed
test: assert rpc error for addnode v2transport not enabled
Added coverage for the addnode rpc when v2transport is not enabled but is set as true when calling addnode rpc
1 parent 45b2a91 commit 345169a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/functional/p2p_v2_transport.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from test_framework.util import (
1313
assert_equal,
1414
p2p_port,
15+
assert_raises_rpc_error
1516
)
1617

1718

@@ -59,6 +60,11 @@ def run_test(self):
5960
# V1 nodes can sync with each other
6061
assert_equal(self.nodes[2].getblockcount(), 0)
6162
assert_equal(self.nodes[3].getblockcount(), 0)
63+
64+
# addnode rpc error when v2transport requested but not enabled
65+
ip_port = "127.0.0.1:{}".format(p2p_port(3))
66+
assert_raises_rpc_error(-8, "Error: v2transport requested but not enabled (see -v2transport)", self.nodes[2].addnode, node=ip_port, command='add', v2transport=True)
67+
6268
with self.nodes[2].assert_debug_log(expected_msgs=[],
6369
unexpected_msgs=[sending_handshake, downgrading_to_v1]):
6470
self.connect_nodes(2, 3, peer_advertises_v2=False)

0 commit comments

Comments
 (0)