diff options
author | Pieter Wuille <pieter@wuille.net> | 2023-08-21 16:55:47 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2023-10-02 18:09:53 -0400 |
commit | 62d21ee0974b582a6a32aa97ee35ef51c977ea4b (patch) | |
tree | 2ba15baa14d626ce9573fd9d175ded0dfe3b322d /test | |
parent | a4706bc877504057e8522c929cc0704d3eaa7302 (diff) | |
download | bitcoin-62d21ee0974b582a6a32aa97ee35ef51c977ea4b.tar.xz |
net: use V2Transport when NODE_P2P_V2 service flag is present
Co-authored-by: Dhruv Mehta <856960+dhruv@users.noreply.github.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/p2p_v2_transport.py | 30 | ||||
-rwxr-xr-x | test/functional/test_runner.py | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test/functional/p2p_v2_transport.py b/test/functional/p2p_v2_transport.py new file mode 100755 index 0000000000..9df4c297e4 --- /dev/null +++ b/test/functional/p2p_v2_transport.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# Copyright (c) 2021-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +""" +Test v2 transport +""" + +from test_framework.messages import NODE_P2P_V2 +from test_framework.test_framework import BitcoinTestFramework +from test_framework.util import assert_equal + +class V2TransportTest(BitcoinTestFramework): + def set_test_params(self): + self.setup_clean_chain=True + self.num_nodes = 1 + self.extra_args = [["-v2transport=0"]] + + def run_test(self): + network_info = self.nodes[0].getnetworkinfo() + assert_equal(int(network_info["localservices"], 16) & NODE_P2P_V2, 0) + assert "P2P_V2" not in network_info["localservicesnames"] + + self.restart_node(0, ["-v2transport=1"]) + network_info = self.nodes[0].getnetworkinfo() + assert_equal(int(network_info["localservices"], 16) & NODE_P2P_V2, NODE_P2P_V2) + assert "P2P_V2" in network_info["localservicesnames"] + +if __name__ == '__main__': + V2TransportTest().main() diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 9a0b5c6f0a..4645557655 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -246,6 +246,7 @@ BASE_SCRIPTS = [ 'p2p_invalid_locator.py', 'p2p_invalid_block.py', 'p2p_invalid_tx.py', + 'p2p_v2_transport.py', 'example_test.py', 'wallet_txn_doublespend.py --legacy-wallet', 'wallet_multisig_descriptor_psbt.py --descriptors', |