Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_inv_download.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2019 The Bitcoin Core developers | # Copyright (c) 2019 The Bitcoin Core 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 inventory download behavior | Test inventory download behavior | ||||
""" | """ | ||||
import functools | |||||
import time | |||||
from test_framework.address import ADDRESS_ECREG_UNSPENDABLE | from test_framework.address import ADDRESS_ECREG_UNSPENDABLE | ||||
from test_framework.avatools import wait_for_proof | from test_framework.avatools import wait_for_proof | ||||
from test_framework.key import ECKey | from test_framework.key import ECKey | ||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
MSG_AVA_PROOF, | |||||
MSG_TX, | |||||
MSG_TYPE_MASK, | |||||
AvalancheProof, | AvalancheProof, | ||||
CInv, | CInv, | ||||
CTransaction, | CTransaction, | ||||
FromHex, | FromHex, | ||||
MSG_AVA_PROOF, | |||||
MSG_TX, | |||||
MSG_TYPE_MASK, | |||||
msg_avaproof, | msg_avaproof, | ||||
msg_inv, | msg_inv, | ||||
msg_notfound, | msg_notfound, | ||||
) | ) | ||||
from test_framework.p2p import ( | from test_framework.p2p import P2PInterface, p2p_lock | ||||
P2PInterface, | |||||
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, | assert_equal, | ||||
assert_raises_rpc_error, | assert_raises_rpc_error, | ||||
wait_until, | wait_until, | ||||
) | ) | ||||
from test_framework.wallet_util import bytes_to_wif | from test_framework.wallet_util import bytes_to_wif | ||||
import functools | |||||
import time | |||||
class TestP2PConn(P2PInterface): | class TestP2PConn(P2PInterface): | ||||
def __init__(self, inv_type): | def __init__(self, inv_type): | ||||
super().__init__() | super().__init__() | ||||
self.inv_type = inv_type | self.inv_type = inv_type | ||||
self.getdata_count = 0 | self.getdata_count = 0 | ||||
def on_getdata(self, message): | def on_getdata(self, message): | ||||
▲ Show 20 Lines • Show All 448 Lines • Show Last 20 Lines |