pytest: add askrene layer creation bench.
What changed, and why it matters
This commit adds a new performance benchmark test to the project's test suite. It exercises a feature called 'askrene' by creating 20,000 empty layers through the normal RPC interface. There is no change to production code, no bug fix, and no security-related behavior.
No security action required. This is a test-only addition.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff appends a single pytest benchmark function test_askrene_layers to tests/benchmark.py. It instantiates one benchmark node and calls l1.rpc.askrene_create_layer(...) 20,000 times with unique names. The commit message explicitly frames this as a benchmark (‘bench’) that performs a lookup and an insert. No code under test is modified.
Changed components
tests/benchmark.pyInspect captured patch +7 / −0
diff --git a/tests/benchmark.py b/tests/benchmark.py
index 97d26f60..73b9a360 100644
--- a/tests/benchmark.py
+++ b/tests/benchmark.py
@@ -262,3 +262,10 @@ def test_payment_speed(node_factory, benchmark):
l1.rpc.waitsendpay(phash)
benchmark(onepay, l1, routestep)
+
+
+def test_askrene_layers(node_factory):
+ l1 = get_bench_node(node_factory)
+ NUM_LAYERS = 20_000
+ for i in range(NUM_LAYERS):
+ l1.rpc.askrene_create_layer(f'test_askrene_layers-{i}')
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.