mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
Merge bitcoin/bitcoin#35553: test: Add missing test case for getdata requests from blocks-only peers
278710a88dtest: Add missing test case for getdata requests from blocks-only peers (Roqqit) Pull request description: ProcessGetData starts by eagerly processing getdata requests. In this loop, a special case checks for peers that have not requested transaction announcements (ie blocksonly) and ignores those requests. This test prevents regressions for that special case, which is currently not covered by existing tests. ACKs for top commit: maflcko: lgtm ACK278710a88dachow101: ACK278710a88dsedited: ACK278710a88dnebula-21: ACK278710a88dTree-SHA512: 2f96efdd4d27e6f754dbdca74c9bf21214f77ee0a05f79ef9d6eb3d8166793346323d71be80bec7fb93bfcb8d764de24f31e5345951591b105557f30ddaabd0e
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
import time
|
||||
|
||||
from test_framework.messages import msg_tx, msg_inv, CInv, MSG_WTX
|
||||
from test_framework.messages import msg_getdata, msg_tx, msg_inv, CInv, MSG_WTX
|
||||
from test_framework.p2p import P2PInterface, P2PTxInvStore
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal
|
||||
@@ -93,6 +93,16 @@ class P2PBlocksOnly(BitcoinTestFramework):
|
||||
assert_equal(self.nodes[0].getpeerinfo()[0]['relaytxes'], False)
|
||||
self.check_p2p_inv_violation(conn)
|
||||
|
||||
self.log.info(
|
||||
"Check that getdata(tx) from a block-relay-only connection is ignored"
|
||||
)
|
||||
conn = self.nodes[0].add_outbound_p2p_connection(
|
||||
P2PInterface(), p2p_idx=0, connection_type="block-relay-only"
|
||||
)
|
||||
conn.send_and_ping(msg_getdata([CInv(t=MSG_WTX, h=0x12345)]))
|
||||
assert_equal(self.nodes[0].getpeerinfo()[0]["relaytxes"], False)
|
||||
assert "notfound" not in conn.last_message
|
||||
|
||||
self.log.info("Check that txs from RPC are not sent to blockrelay connection")
|
||||
conn = self.nodes[0].add_outbound_p2p_connection(P2PTxInvStore(), p2p_idx=1, connection_type="block-relay-only")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user