Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: use V2Transport when NODE_P2P_V2 service flag is present
Co-authored-by: Dhruv Mehta <856960+dhruv@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters