mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #13350: [tests] Add logging to provide anchor points when debugging p2p_sendheaders
2ce81867b2 [tests] Add logging to provide anchor points when debugging failures. (Lowell Manners) Pull request description: refs #12453 Tree-SHA512: 0ad432bd848723a5b813df4d35fcd8c81d152f042499c8340a9a2a9b7918d6e785efbf9f07b63b6c0253a949044cebdb51802971c09fb8dde0efa5169f34ef20 Signed-off-by: pasta <pasta@dashboost.org> # Conflicts: # test/functional/sendheaders.py
This commit is contained in:
parent
8a78e4f152
commit
c14b2e9ef3
@ -286,6 +286,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
|||||||
# 1. Mine a block; expect inv announcements each time
|
# 1. Mine a block; expect inv announcements each time
|
||||||
self.log.info("Part 1: headers don't start before sendheaders message...")
|
self.log.info("Part 1: headers don't start before sendheaders message...")
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
|
self.log.debug("Part 1.{}: starting...".format(i))
|
||||||
old_tip = tip
|
old_tip = tip
|
||||||
tip = self.mine_blocks(1)
|
tip = self.mine_blocks(1)
|
||||||
inv_node.check_last_inv_announcement(inv=[tip])
|
inv_node.check_last_inv_announcement(inv=[tip])
|
||||||
@ -335,11 +336,13 @@ class SendHeadersTest(BitcoinTestFramework):
|
|||||||
height = self.nodes[0].getblockcount() + 1
|
height = self.nodes[0].getblockcount() + 1
|
||||||
block_time += 10 # Advance far enough ahead
|
block_time += 10 # Advance far enough ahead
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
self.log.debug("Part 2.{}: starting...".format(i))
|
||||||
# Mine i blocks, and alternate announcing either via
|
# Mine i blocks, and alternate announcing either via
|
||||||
# inv (of tip) or via headers. After each, new blocks
|
# inv (of tip) or via headers. After each, new blocks
|
||||||
# mined by the node should successfully be announced
|
# mined by the node should successfully be announced
|
||||||
# with block header, even though the blocks are never requested
|
# with block header, even though the blocks are never requested
|
||||||
for j in range(2):
|
for j in range(2):
|
||||||
|
self.log.debug("Part 2.{}.{}: starting...".format(i, j))
|
||||||
blocks = []
|
blocks = []
|
||||||
for b in range(i + 1):
|
for b in range(i + 1):
|
||||||
blocks.append(create_block(tip, create_coinbase(height), block_time))
|
blocks.append(create_block(tip, create_coinbase(height), block_time))
|
||||||
@ -386,6 +389,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
|||||||
# PART 3. Headers announcements can stop after large reorg, and resume after
|
# PART 3. Headers announcements can stop after large reorg, and resume after
|
||||||
# getheaders or inv from peer.
|
# getheaders or inv from peer.
|
||||||
for j in range(2):
|
for j in range(2):
|
||||||
|
self.log.debug("Part 3.{}: starting...".format(j))
|
||||||
# First try mining a reorg that can propagate with header announcement
|
# First try mining a reorg that can propagate with header announcement
|
||||||
new_block_hashes = self.mine_reorg(length=7)
|
new_block_hashes = self.mine_reorg(length=7)
|
||||||
tip = new_block_hashes[-1]
|
tip = new_block_hashes[-1]
|
||||||
@ -412,6 +416,8 @@ class SendHeadersTest(BitcoinTestFramework):
|
|||||||
test_node.wait_for_block(new_block_hashes[-1])
|
test_node.wait_for_block(new_block_hashes[-1])
|
||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
self.log.debug("Part 3.{}.{}: starting...".format(j, i))
|
||||||
|
|
||||||
# Mine another block, still should get only an inv
|
# Mine another block, still should get only an inv
|
||||||
tip = self.mine_blocks(1)
|
tip = self.mine_blocks(1)
|
||||||
inv_node.check_last_inv_announcement(inv=[tip])
|
inv_node.check_last_inv_announcement(inv=[tip])
|
||||||
@ -427,11 +433,11 @@ class SendHeadersTest(BitcoinTestFramework):
|
|||||||
test_node.send_get_data([tip])
|
test_node.send_get_data([tip])
|
||||||
test_node.wait_for_block(tip)
|
test_node.wait_for_block(tip)
|
||||||
elif i == 2:
|
elif i == 2:
|
||||||
test_node.send_get_data([tip])
|
|
||||||
test_node.wait_for_block(tip)
|
|
||||||
# This time, try sending either a getheaders to trigger resumption
|
# This time, try sending either a getheaders to trigger resumption
|
||||||
# of headers announcements, or mine a new block and inv it, also
|
# of headers announcements, or mine a new block and inv it, also
|
||||||
# triggering resumption of headers announcements.
|
# triggering resumption of headers announcements.
|
||||||
|
test_node.send_get_data([tip])
|
||||||
|
test_node.wait_for_block(tip)
|
||||||
if j == 0:
|
if j == 0:
|
||||||
test_node.send_get_headers(locator=[tip], hashstop=0)
|
test_node.send_get_headers(locator=[tip], hashstop=0)
|
||||||
test_node.sync_with_ping()
|
test_node.sync_with_ping()
|
||||||
@ -535,6 +541,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
|||||||
# First we test that receipt of an unconnecting header doesn't prevent
|
# First we test that receipt of an unconnecting header doesn't prevent
|
||||||
# chain sync.
|
# chain sync.
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
self.log.debug("Part 5.{}: starting...".format(i))
|
||||||
test_node.last_message.pop("getdata", None)
|
test_node.last_message.pop("getdata", None)
|
||||||
blocks = []
|
blocks = []
|
||||||
# Create two more blocks.
|
# Create two more blocks.
|
||||||
|
Loading…
Reference in New Issue
Block a user