Skip to content

Commit 89fe5fe

Browse files
committed
[tests] Stop feature_block.py from blowing up memory.
The new P2PDataStore class was sending full blocks in headers messages, which meant that calls to send_blocks_and_test() would blow up memory if called with a large number of blocks. Fix that by only sending headers in headers messages.
1 parent 18815b4 commit 89fe5fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/test_framework/mininode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def on_getheaders(self, message):
498498
# as we go.
499499
prev_block_hash = headers_list[-1].hashPrevBlock
500500
if prev_block_hash in self.block_store:
501-
prev_block_header = self.block_store[prev_block_hash]
501+
prev_block_header = CBlockHeader(self.block_store[prev_block_hash])
502502
headers_list.append(prev_block_header)
503503
if prev_block_header.sha256 == hash_stop:
504504
# if this is the hashstop header, stop here
@@ -539,7 +539,7 @@ def send_blocks_and_test(self, blocks, rpc, success=True, request_block=True, re
539539
self.block_store[block.sha256] = block
540540
self.last_block_hash = block.sha256
541541

542-
self.send_message(msg_headers([blocks[-1]]))
542+
self.send_message(msg_headers([CBlockHeader(blocks[-1])]))
543543

544544
if request_block:
545545
wait_until(lambda: blocks[-1].sha256 in self.getdata_requests, timeout=timeout, lock=mininode_lock)

0 commit comments

Comments
 (0)