Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_sendheaders.py
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | c. Announce a header that does connect. | ||||
Expect: no response. | Expect: no response. | ||||
d. Announce 49 headers that don't connect. | d. Announce 49 headers that don't connect. | ||||
Expect: getheaders message each time. | Expect: getheaders message each time. | ||||
e. Announce one more that doesn't connect. | e. Announce one more that doesn't connect. | ||||
Expect: disconnect. | Expect: disconnect. | ||||
""" | """ | ||||
from test_framework.blocktools import create_block, create_coinbase | from test_framework.blocktools import create_block, create_coinbase | ||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
MSG_BLOCK, | |||||
CBlockHeader, | CBlockHeader, | ||||
CInv, | CInv, | ||||
MSG_BLOCK, | |||||
msg_block, | msg_block, | ||||
msg_getblocks, | msg_getblocks, | ||||
msg_getdata, | msg_getdata, | ||||
msg_getheaders, | msg_getheaders, | ||||
msg_headers, | msg_headers, | ||||
msg_inv, | msg_inv, | ||||
msg_sendheaders, | msg_sendheaders, | ||||
) | ) | ||||
from test_framework.p2p import ( | from test_framework.p2p import P2PInterface, p2p_lock | ||||
p2p_lock, | |||||
P2PInterface, | |||||
) | |||||
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, | |||||
) | |||||
DIRECT_FETCH_RESPONSE_TIME = 0.05 | DIRECT_FETCH_RESPONSE_TIME = 0.05 | ||||
class BaseNode(P2PInterface): | class BaseNode(P2PInterface): | ||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
self.block_announced = False | self.block_announced = False | ||||
▲ Show 20 Lines • Show All 520 Lines • Show Last 20 Lines |