mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
net: use V2Transport when NODE_P2P_V2 service flag is present
Co-authored-by: Dhruv Mehta <856960+dhruv@users.noreply.github.com>
This commit is contained in:
30
test/functional/p2p_v2_transport.py
Executable file
30
test/functional/p2p_v2_transport.py
Executable file
@ -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()
|
Reference in New Issue
Block a user