Skip to content

Commit f532d52

Browse files
author
MarcoFalke
committed
Merge #13350: [tests] Add logging to provide anchor points when debugging p2p_sendheaders
2ce8186 [tests] Add logging to provide anchor points when debugging failures. (Lowell Manners) Pull request description: refs #12453 Tree-SHA512: 0ad432bd848723a5b813df4d35fcd8c81d152f042499c8340a9a2a9b7918d6e785efbf9f07b63b6c0253a949044cebdb51802971c09fb8dde0efa5169f34ef20
2 parents 8eb76f3 + 2ce8186 commit f532d52

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/functional/p2p_sendheaders.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ def test_nonnull_locators(self, test_node, inv_node):
288288
# 1. Mine a block; expect inv announcements each time
289289
self.log.info("Part 1: headers don't start before sendheaders message...")
290290
for i in range(4):
291+
self.log.debug("Part 1.{}: starting...".format(i))
291292
old_tip = tip
292293
tip = self.mine_blocks(1)
293294
inv_node.check_last_inv_announcement(inv=[tip])
@@ -335,11 +336,13 @@ def test_nonnull_locators(self, test_node, inv_node):
335336
height = self.nodes[0].getblockcount() + 1
336337
block_time += 10 # Advance far enough ahead
337338
for i in range(10):
339+
self.log.debug("Part 2.{}: starting...".format(i))
338340
# Mine i blocks, and alternate announcing either via
339341
# inv (of tip) or via headers. After each, new blocks
340342
# mined by the node should successfully be announced
341343
# with block header, even though the blocks are never requested
342344
for j in range(2):
345+
self.log.debug("Part 2.{}.{}: starting...".format(i, j))
343346
blocks = []
344347
for b in range(i + 1):
345348
blocks.append(create_block(tip, create_coinbase(height), block_time))
@@ -386,6 +389,7 @@ def test_nonnull_locators(self, test_node, inv_node):
386389
# PART 3. Headers announcements can stop after large reorg, and resume after
387390
# getheaders or inv from peer.
388391
for j in range(2):
392+
self.log.debug("Part 3.{}: starting...".format(j))
389393
# First try mining a reorg that can propagate with header announcement
390394
new_block_hashes = self.mine_reorg(length=7)
391395
tip = new_block_hashes[-1]
@@ -412,23 +416,28 @@ def test_nonnull_locators(self, test_node, inv_node):
412416
test_node.wait_for_block(new_block_hashes[-1])
413417

414418
for i in range(3):
419+
self.log.debug("Part 3.{}.{}: starting...".format(j, i))
420+
415421
# Mine another block, still should get only an inv
416422
tip = self.mine_blocks(1)
417423
inv_node.check_last_inv_announcement(inv=[tip])
418424
test_node.check_last_inv_announcement(inv=[tip])
419425
if i == 0:
420-
self.log.debug("Just get the data -- shouldn't cause headers announcements to resume")
426+
# Just get the data -- shouldn't cause headers announcements to resume
421427
test_node.send_get_data([tip])
422428
test_node.wait_for_block(tip)
423429
elif i == 1:
424-
self.log.debug("Send a getheaders message that shouldn't trigger headers announcements to resume (best header sent will be too old)")
430+
# Send a getheaders message that shouldn't trigger headers announcements
431+
# to resume (best header sent will be too old)
425432
test_node.send_get_headers(locator=[fork_point], hashstop=new_block_hashes[1])
426433
test_node.send_get_data([tip])
427434
test_node.wait_for_block(tip)
428435
elif i == 2:
436+
# This time, try sending either a getheaders to trigger resumption
437+
# of headers announcements, or mine a new block and inv it, also
438+
# triggering resumption of headers announcements.
429439
test_node.send_get_data([tip])
430440
test_node.wait_for_block(tip)
431-
self.log.debug("This time, try sending either a getheaders to trigger resumption of headers announcements, or mine a new block and inv it, also triggering resumption of headers announcements.")
432441
if j == 0:
433442
test_node.send_get_headers(locator=[tip], hashstop=0)
434443
test_node.sync_with_ping()
@@ -532,6 +541,7 @@ def test_nonnull_locators(self, test_node, inv_node):
532541
# First we test that receipt of an unconnecting header doesn't prevent
533542
# chain sync.
534543
for i in range(10):
544+
self.log.debug("Part 5.{}: starting...".format(i))
535545
test_node.last_message.pop("getdata", None)
536546
blocks = []
537547
# Create two more blocks.

0 commit comments

Comments
 (0)