pytest: speed up test_sql significantly.
What changed, and why it matters
This commit only speeds up a slow automated test by reducing how long a test plugin deliberately holds a payment. It does not change any production code, network behavior, or security logic. There is no security issue.
No action needed. This is a test-only performance optimization.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is in tests/test_plugin.py. The test_sql test uses the hold_invoice.py test plugin to keep an HTLC in flight while querying peer channel HTLC data. The hold time was reduced from TIMEOUT * 2 to int(math.sqrt(TIMEOUT) + 1) * 2 to cut CI runtime. No Lightning protocol, wallet, or plugin runtime code is modified.
Changed components
tests/test_plugin.pyInspect captured patch +2 / −1
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 2e18c2d9..b48d0c03 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -17,6 +17,7 @@ from tests.test_wallet import HsmTool, write_all, WAIT_TIMEOUT
import ast
import copy
import json
+import math
import os
import pytest
import random
@@ -4034,7 +4035,7 @@ def test_sql(node_factory, bitcoind):
# And I need at least one HTLC in-flight so listpeers.channels.htlcs isn't empty:
l3.rpc.plugin_start(os.path.join(os.getcwd(), 'tests/plugins/hold_invoice.py'),
- holdtime=TIMEOUT * 2)
+ holdtime=int(math.sqrt(TIMEOUT) + 1) * 2)
inv = l3.rpc.invoice(amount_msat=12300, label='inv3', description='description')
route = l1.rpc.getroute(l3.info['id'], 12300, 1)['route']
l1.rpc.sendpay(route, inv['payment_hash'], payment_secret=inv['payment_secret'])
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.