Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_avalanche_peer_discovery.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2020-2021 The Bitcoin developers | # Copyright (c) 2020-2021 The Bitcoin developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test the peer discovery behavior of avalanche nodes. | """Test the peer discovery behavior of avalanche nodes. | ||||
This includes tests for the service flag, avahello handshake and | This includes tests for the service flag, avahello handshake and | ||||
proof exchange. | proof exchange. | ||||
""" | """ | ||||
import time | import time | ||||
from test_framework.address import ADDRESS_ECREG_UNSPENDABLE | from test_framework.address import ADDRESS_ECREG_UNSPENDABLE | ||||
from test_framework.avatools import ( | from test_framework.avatools import ( | ||||
get_ava_p2p_interface, | |||||
create_coinbase_stakes, | create_coinbase_stakes, | ||||
get_ava_p2p_interface, | |||||
get_proof_ids, | get_proof_ids, | ||||
) | ) | ||||
from test_framework.key import ( | from test_framework.key import ECKey, ECPubKey | ||||
ECKey, | |||||
ECPubKey, | |||||
) | |||||
from test_framework.p2p import p2p_lock | |||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
MSG_AVA_PROOF, | |||||
NODE_AVALANCHE, | |||||
NODE_NETWORK, | |||||
AvalancheProof, | AvalancheProof, | ||||
CInv, | CInv, | ||||
FromHex, | FromHex, | ||||
MSG_AVA_PROOF, | |||||
msg_getdata, | msg_getdata, | ||||
NODE_AVALANCHE, | |||||
NODE_NETWORK, | |||||
) | ) | ||||
from test_framework.p2p import p2p_lock | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import assert_equal, wait_until | ||||
assert_equal, | |||||
wait_until, | |||||
) | |||||
from test_framework.wallet_util import bytes_to_wif | from test_framework.wallet_util import bytes_to_wif | ||||
UNCONDITIONAL_RELAY_DELAY = 2 * 60 | UNCONDITIONAL_RELAY_DELAY = 2 * 60 | ||||
class AvalancheTest(BitcoinTestFramework): | class AvalancheTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |