pytest: increase test_generate_coinmoves to 5M entries.
What changed, and why it matters
This commit only changes a test file. It increases the number of simulated accounting entries in a performance benchmark from 2 million to 5 million and prints more detailed latency statistics. There is no change to the actual Core Lightning node software, no security fix, and no vulnerability introduced.
No security action needed. This is a benign test-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies tests/test_coinmoves.py. It adds an import of the statistics module, raises the test_generate_coinmoves loop count from 2,000,000 to 5,000,000 entries, and replaces a simple max-latency assertion with a printed min/median/max summary plus the same assertion. The commit message describes this as a regression test to catch future latency spikes in large-node coin-move handling. The Changelog-Fixed line references prior performance improvements, but those improvements are not part of this diff.
Changed components
tests/test_coinmoves.pyInspect captured patch +6 / −3
diff --git a/tests/test_coinmoves.py b/tests/test_coinmoves.py
index d9366cd6..9fb31717 100644
--- a/tests/test_coinmoves.py
+++ b/tests/test_coinmoves.py
@@ -10,6 +10,7 @@ import pytest
import random
import re
import threading
+import statistics
import time
from pyln.testing.utils import EXPERIMENTAL_DUAL_FUND
@@ -2110,8 +2111,8 @@ def test_generate_coinmoves(node_factory, bitcoind, executor):
next_timestamp = entries[-1]['timestamp'] + 1
batch = []
- # Let's make 2 million entries.
- for _ in range(2_000_000 // len(entries)):
+ # Let's make 5 million entries.
+ for _ in range(5_000_000 // len(entries)):
# Random payment_hash
entries[0]['payment_hash'] = entries[1]['payment_hash'] = random.randbytes(32)
entries[2]['payment_hash'] = random.randbytes(32)
@@ -2170,4 +2171,6 @@ def test_generate_coinmoves(node_factory, bitcoind, executor):
stopme.set()
# Latency under 1 second
- assert max(fut.result(TIMEOUT)) < 1
+ latencies = fut.result(TIMEOUT)
+ print(f"RESULT: min, median, max: {min(latencies)}, {statistics.median(latencies)}, {max(latencies)}")
+ assert max(latencies) < 1
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.