v31.1-roots.1 · Commit 2: [PATCH 02/17] feat(policy): preserve Roots parsing and local transaction checks
test/functional/p2p_tx_download.py
Before: test/functional/p2p_tx_download.py · After: test/functional/p2p_tx_download.py
File metadata
index f1a42f5a7dac6a96b091409ad5a04c43c1307f32..e15c197851d89080f112a8640bf57c51c8271848 100755
Download original patch · Release notes
Diff rows 1–33 of 33. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/p2p_tx_download.py
CHANGED
|
@@ -68,7 +68,8 @@ class ConnectionType(Enum):
|
|
| 68 |
class TxDownloadTest(BitcoinTestFramework):
|
| 69 |
def set_test_params(self):
|
| 70 |
self.num_nodes = 2
|
| 71 |
-
self.extra_args= [['-maxmempool=5', '-persistmempool=0']] * self.num_nodes
|
|
|
|
| 72 |
|
| 73 |
def test_tx_requests(self):
|
| 74 |
self.log.info("Test that we request transactions from all our peers, eventually")
|
|
@@ -210,7 +211,7 @@ class TxDownloadTest(BitcoinTestFramework):
|
|
| 210 |
def test_preferred_inv(self, connection_type: ConnectionType):
|
| 211 |
if connection_type == ConnectionType.WHITELIST:
|
| 212 |
self.log.info('Check invs from preferred (whitelisted) peers are downloaded immediately')
|
| 213 |
-
self.restart_node(0, extra_args=['-whitelist=noban@127.0.0.1'])
|
| 214 |
elif connection_type == ConnectionType.OUTBOUND:
|
| 215 |
self.log.info('Check invs from preferred (outbound) peers are downloaded immediately')
|
| 216 |
self.restart_node(0)
|
|
@@ -290,7 +291,7 @@ class TxDownloadTest(BitcoinTestFramework):
|
|
| 290 |
|
| 291 |
def test_txid_inv_delay(self, glob_wtxid=False):
|
| 292 |
self.log.info('Check that inv from a txid-relay peers are delayed by {} s, with a wtxid peer {}'.format(TXID_RELAY_DELAY, glob_wtxid))
|
| 293 |
-
self.restart_node(0, extra_args=['-whitelist=noban@127.0.0.1'])
|
| 294 |
mock_time = int(time.time() + 1)
|
| 295 |
self.nodes[0].setmocktime(mock_time)
|
| 296 |
peer = self.nodes[0].add_p2p_connection(TestP2PConn(wtxidrelay=False))
|
|
@@ -306,7 +307,7 @@ class TxDownloadTest(BitcoinTestFramework):
|
|
| 306 |
|
| 307 |
def test_large_inv_batch(self):
|
| 308 |
self.log.info('Test how large inv batches are handled with relay permission')
|
| 309 |
-
self.restart_node(0, extra_args=['-whitelist=relay@127.0.0.1'])
|
| 310 |
peer = self.nodes[0].add_p2p_connection(TestP2PConn())
|
| 311 |
peer.send_without_ping(msg_inv([CInv(t=MSG_WTX, h=wtxid) for wtxid in range(MAX_PEER_TX_ANNOUNCEMENTS + 1)]))
|
| 312 |
peer.wait_until(lambda: peer.tx_getdata_count == MAX_PEER_TX_ANNOUNCEMENTS + 1)
|
|
|
|
| 68 |
class TxDownloadTest(BitcoinTestFramework):
|
| 69 |
def set_test_params(self):
|
| 70 |
self.num_nodes = 2
|
| 71 |
+
# Allow the large carrier padding used by fill_mempool().
|
| 72 |
+
self.extra_args = [['-maxmempool=5', '-persistmempool=0', '-maxscriptsize=1000000', '-datacarriersize=1000000']] * self.num_nodes
|
| 73 |
|
| 74 |
def test_tx_requests(self):
|
| 75 |
self.log.info("Test that we request transactions from all our peers, eventually")
|
|
|
|
| 211 |
def test_preferred_inv(self, connection_type: ConnectionType):
|
| 212 |
if connection_type == ConnectionType.WHITELIST:
|
| 213 |
self.log.info('Check invs from preferred (whitelisted) peers are downloaded immediately')
|
| 214 |
+
self.restart_node(0, extra_args=self.extra_args[0] + ['-whitelist=noban@127.0.0.1'])
|
| 215 |
elif connection_type == ConnectionType.OUTBOUND:
|
| 216 |
self.log.info('Check invs from preferred (outbound) peers are downloaded immediately')
|
| 217 |
self.restart_node(0)
|
|
|
|
| 291 |
|
| 292 |
def test_txid_inv_delay(self, glob_wtxid=False):
|
| 293 |
self.log.info('Check that inv from a txid-relay peers are delayed by {} s, with a wtxid peer {}'.format(TXID_RELAY_DELAY, glob_wtxid))
|
| 294 |
+
self.restart_node(0, extra_args=self.extra_args[0] + ['-whitelist=noban@127.0.0.1'])
|
| 295 |
mock_time = int(time.time() + 1)
|
| 296 |
self.nodes[0].setmocktime(mock_time)
|
| 297 |
peer = self.nodes[0].add_p2p_connection(TestP2PConn(wtxidrelay=False))
|
|
|
|
| 307 |
|
| 308 |
def test_large_inv_batch(self):
|
| 309 |
self.log.info('Test how large inv batches are handled with relay permission')
|
| 310 |
+
self.restart_node(0, extra_args=self.extra_args[0] + ['-whitelist=relay@127.0.0.1'])
|
| 311 |
peer = self.nodes[0].add_p2p_connection(TestP2PConn())
|
| 312 |
peer.send_without_ping(msg_inv([CInv(t=MSG_WTX, h=wtxid) for wtxid in range(MAX_PEER_TX_ANNOUNCEMENTS + 1)]))
|
| 313 |
peer.wait_until(lambda: peer.tx_getdata_count == MAX_PEER_TX_ANNOUNCEMENTS + 1)
|