Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_unrequested_blocks.py
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert(tip_entry_found) | assert(tip_entry_found) | ||||
self.nodes[0].getblock(block_h3.hash) | self.nodes[0].getblock(block_h3.hash) | ||||
# But this block should be accepted by node since it has more work. | # But this block should be accepted by node since it has more work. | ||||
self.nodes[0].getblock(block_h3.hash) | self.nodes[0].getblock(block_h3.hash) | ||||
self.log.info("Unrequested more-work block accepted") | self.log.info("Unrequested more-work block accepted") | ||||
# 4c. Now mine 288 more blocks and deliver; all should be processed but | # 4c. Now mine 288 more blocks and deliver; all should be processed but | ||||
# the last (height-too-high) on node (as long as its not missing any headers) | # the last (height-too-high) on node (as long as it is not missing any headers) | ||||
tip = block_h3 | tip = block_h3 | ||||
all_blocks = [] | all_blocks = [] | ||||
for i in range(288): | for i in range(288): | ||||
next_block = create_block( | next_block = create_block( | ||||
tip.sha256, create_coinbase(i + 4), tip.nTime+1) | tip.sha256, create_coinbase(i + 4), tip.nTime+1) | ||||
next_block.solve() | next_block.solve() | ||||
all_blocks.append(next_block) | all_blocks.append(next_block) | ||||
tip = next_block | tip = next_block | ||||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |