Skip to content

Commit 314ebdf

Browse files
author
MarcoFalke
committed
Merge #10134: [qa] Fixes segwit block relay test after inv-direct-fetch was disabled
f19abd9 [qa] Fixes segwit block relay test after inv-direct-fetch was disabled (Suhas Daftuar) Tree-SHA512: 4df0074cbf3d9d31b7906026dc3296b143c252a81aef47eee0bcdf6cddc2501f83cb8d1b5a13256f9d7e889306d4435f260c1fa827573ae8569bb241a89a5f82
2 parents e927483 + f19abd9 commit 314ebdf

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/functional/p2p-segwit.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ def announce_block_and_wait_for_getdata(self, block, use_header, timeout=60):
6161
self.send_message(msg)
6262
self.wait_for_getdata()
6363

64-
def announce_block(self, block, use_header):
65-
with mininode_lock:
66-
self.last_message.pop("getdata", None)
67-
if use_header:
68-
msg = msg_headers()
69-
msg.headers = [ CBlockHeader(block) ]
70-
self.send_message(msg)
71-
else:
72-
self.send_message(msg_inv(inv=[CInv(2, block.sha256)]))
73-
7464
def request_block(self, blockhash, inv_type, timeout=60):
7565
with mininode_lock:
7666
self.last_message.pop("block", None)
@@ -1029,13 +1019,18 @@ def test_block_relay(self, segwit_activated):
10291019
block4 = self.build_next_block(nVersion=4)
10301020
block4.solve()
10311021
self.old_node.getdataset = set()
1022+
10321023
# Blocks can be requested via direct-fetch (immediately upon processing the announcement)
10331024
# or via parallel download (with an indeterminate delay from processing the announcement)
10341025
# so to test that a block is NOT requested, we could guess a time period to sleep for,
10351026
# and then check. We can avoid the sleep() by taking advantage of transaction getdata's
10361027
# being processed after block getdata's, and announce a transaction as well,
10371028
# and then check to see if that particular getdata has been received.
1038-
self.old_node.announce_block(block4, use_header=False)
1029+
# Since 0.14, inv's will only be responded to with a getheaders, so send a header
1030+
# to announce this block.
1031+
msg = msg_headers()
1032+
msg.headers = [ CBlockHeader(block4) ]
1033+
self.old_node.send_message(msg)
10391034
self.old_node.announce_tx_and_wait_for_getdata(block4.vtx[0])
10401035
assert(block4.sha256 not in self.old_node.getdataset)
10411036

0 commit comments

Comments
 (0)