2021-01-22 15:58:07 +01:00
|
|
|
#!/usr/bin/env python3
|
2023-01-12 22:26:21 +01:00
|
|
|
# Copyright (c) 2021-2022 The Dash Core developers
|
2021-01-22 15:58:07 +01:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
"""Test being able to connect to the same devnet"""
|
|
|
|
|
2021-07-22 10:24:46 +02:00
|
|
|
from test_framework.mininode import P2PInterface
|
2021-01-22 15:58:07 +01:00
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
2022-09-24 14:36:35 +02:00
|
|
|
from test_framework.util import assert_equal
|
2021-01-22 15:58:07 +01:00
|
|
|
|
|
|
|
class ConnectDevnetNodes(BitcoinTestFramework):
|
|
|
|
def set_test_params(self):
|
|
|
|
self.setup_clean_chain = True
|
|
|
|
self.chain = "devnet"
|
|
|
|
self.num_nodes = 2
|
|
|
|
|
|
|
|
def setup_network(self):
|
|
|
|
self.add_nodes(self.num_nodes)
|
|
|
|
self.start_node(0)
|
|
|
|
self.start_node(1)
|
2022-09-24 14:36:35 +02:00
|
|
|
self.connect_nodes(0, 1)
|
2021-01-22 15:58:07 +01:00
|
|
|
self.sync_all()
|
|
|
|
|
|
|
|
|
|
|
|
def run_test(self):
|
2021-07-22 10:24:46 +02:00
|
|
|
self.nodes[0].add_p2p_connection(P2PInterface())
|
2019-09-18 20:41:14 +02:00
|
|
|
assert_equal(self.nodes[0].getconnectioncount(), 2) # 1 out dashd + 1 p2p
|
2021-07-22 10:24:46 +02:00
|
|
|
|
2021-01-22 15:58:07 +01:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
ConnectDevnetNodes().main()
|