Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/p2p.py
Show All 15 Lines | |||||
P2PConnection: A low-level connection object to a node's P2P interface | P2PConnection: A low-level connection object to a node's P2P interface | ||||
P2PInterface: A high-level interface object for communicating to a node over P2P | P2PInterface: A high-level interface object for communicating to a node over P2P | ||||
P2PDataStore: A p2p interface class that keeps a store of transactions and blocks | P2PDataStore: A p2p interface class that keeps a store of transactions and blocks | ||||
and can respond correctly to getdata and getheaders messages | and can respond correctly to getdata and getheaders messages | ||||
P2PTxInvStore: A p2p interface class that inherits from P2PDataStore, and keeps | P2PTxInvStore: A p2p interface class that inherits from P2PDataStore, and keeps | ||||
a count of how many times each txid has been announced.""" | a count of how many times each txid has been announced.""" | ||||
import asyncio | import asyncio | ||||
from collections import defaultdict | |||||
from io import BytesIO | |||||
import logging | import logging | ||||
import struct | import struct | ||||
import sys | import sys | ||||
import threading | import threading | ||||
from collections import defaultdict | |||||
from io import BytesIO | |||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
CBlockHeader, | |||||
MAX_HEADERS_RESULTS, | MAX_HEADERS_RESULTS, | ||||
MIN_VERSION_SUPPORTED, | MIN_VERSION_SUPPORTED, | ||||
MSG_BLOCK, | |||||
MSG_TX, | |||||
MSG_TYPE_MASK, | |||||
NODE_NETWORK, | |||||
CBlockHeader, | |||||
msg_addr, | msg_addr, | ||||
msg_addrv2, | msg_addrv2, | ||||
msg_avahello, | |||||
msg_avapoll, | msg_avapoll, | ||||
msg_avaproof, | msg_avaproof, | ||||
msg_tcpavaresponse, | |||||
msg_avahello, | |||||
msg_block, | msg_block, | ||||
MSG_BLOCK, | |||||
msg_blocktxn, | msg_blocktxn, | ||||
msg_cfcheckpt, | msg_cfcheckpt, | ||||
msg_cfheaders, | msg_cfheaders, | ||||
msg_cfilter, | msg_cfilter, | ||||
msg_cmpctblock, | msg_cmpctblock, | ||||
msg_feefilter, | msg_feefilter, | ||||
msg_filteradd, | msg_filteradd, | ||||
msg_filterclear, | msg_filterclear, | ||||
msg_filterload, | msg_filterload, | ||||
msg_getaddr, | msg_getaddr, | ||||
msg_getblocks, | msg_getblocks, | ||||
msg_getblocktxn, | msg_getblocktxn, | ||||
msg_getdata, | msg_getdata, | ||||
msg_getheaders, | msg_getheaders, | ||||
msg_headers, | msg_headers, | ||||
msg_inv, | msg_inv, | ||||
msg_mempool, | msg_mempool, | ||||
msg_merkleblock, | msg_merkleblock, | ||||
msg_notfound, | msg_notfound, | ||||
msg_ping, | msg_ping, | ||||
msg_pong, | msg_pong, | ||||
msg_sendaddrv2, | msg_sendaddrv2, | ||||
msg_sendcmpct, | msg_sendcmpct, | ||||
msg_sendheaders, | msg_sendheaders, | ||||
msg_tcpavaresponse, | |||||
msg_tx, | msg_tx, | ||||
MSG_TX, | |||||
MSG_TYPE_MASK, | |||||
msg_verack, | msg_verack, | ||||
msg_version, | msg_version, | ||||
NODE_NETWORK, | |||||
sha256, | sha256, | ||||
) | ) | ||||
from test_framework.util import wait_until | from test_framework.util import wait_until | ||||
logger = logging.getLogger("TestFramework.p2p") | logger = logging.getLogger("TestFramework.p2p") | ||||
MESSAGEMAP = { | MESSAGEMAP = { | ||||
b"addr": msg_addr, | b"addr": msg_addr, | ||||
▲ Show 20 Lines • Show All 720 Lines • Show Last 20 Lines |