mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-02 08:51:21 +01:00
test: replace inv type magic numbers by constants
This commit is contained in:
@@ -63,7 +63,7 @@ class TxDownloadTest(BitcoinTestFramework):
|
||||
txid = 0xdeadbeef
|
||||
|
||||
self.log.info("Announce the txid from each incoming peer to node 0")
|
||||
msg = msg_inv([CInv(t=1, h=txid)])
|
||||
msg = msg_inv([CInv(t=MSG_TX, h=txid)])
|
||||
for p in self.nodes[0].p2ps:
|
||||
p.send_and_ping(msg)
|
||||
|
||||
@@ -104,7 +104,7 @@ class TxDownloadTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info(
|
||||
"Announce the transaction to all nodes from all {} incoming peers, but never send it".format(NUM_INBOUND))
|
||||
msg = msg_inv([CInv(t=1, h=txid)])
|
||||
msg = msg_inv([CInv(t=MSG_TX, h=txid)])
|
||||
for p in self.peers:
|
||||
p.send_and_ping(msg)
|
||||
|
||||
@@ -135,13 +135,13 @@ class TxDownloadTest(BitcoinTestFramework):
|
||||
with mininode_lock:
|
||||
p.tx_getdata_count = 0
|
||||
|
||||
p.send_message(msg_inv([CInv(t=1, h=i) for i in txids]))
|
||||
p.send_message(msg_inv([CInv(t=MSG_TX, h=i) for i in txids]))
|
||||
wait_until(lambda: p.tx_getdata_count >= MAX_GETDATA_IN_FLIGHT, lock=mininode_lock)
|
||||
with mininode_lock:
|
||||
assert_equal(p.tx_getdata_count, MAX_GETDATA_IN_FLIGHT)
|
||||
|
||||
self.log.info("Now check that if we send a NOTFOUND for a transaction, we'll get one more request")
|
||||
p.send_message(msg_notfound(vec=[CInv(t=1, h=txids[0])]))
|
||||
p.send_message(msg_notfound(vec=[CInv(t=MSG_TX, h=txids[0])]))
|
||||
wait_until(lambda: p.tx_getdata_count >= MAX_GETDATA_IN_FLIGHT + 1, timeout=10, lock=mininode_lock)
|
||||
with mininode_lock:
|
||||
assert_equal(p.tx_getdata_count, MAX_GETDATA_IN_FLIGHT + 1)
|
||||
@@ -154,7 +154,7 @@ class TxDownloadTest(BitcoinTestFramework):
|
||||
|
||||
def test_spurious_notfound(self):
|
||||
self.log.info('Check that spurious notfound is ignored')
|
||||
self.nodes[0].p2ps[0].send_message(msg_notfound(vec=[CInv(1, 1)]))
|
||||
self.nodes[0].p2ps[0].send_message(msg_notfound(vec=[CInv(MSG_TX, 1)]))
|
||||
|
||||
def run_test(self):
|
||||
# Setup the p2p connections
|
||||
|
||||
Reference in New Issue
Block a user