What changed, and why it matters
This commit only moves and adapts a unit test for Electrum's Lightning trampoline routing feature. It changes where a test case lives and how many payment attempts are expected, but it does not fix any user-facing bug or change any production security behavior. There is no indication this is a security patch.
No security action required. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff in electrum/trampoline.py merely adds an unused import electrum_ecc as ecc line. The substantive changes are in tests/test_lnpeer.py: the end-to-end trampoline test that previously expected failure on 1 attempt and success on 30 attempts is relocated from test_payment_multipart_trampoline to test_payment_multipart_trampoline_legacy, and a new single-attempt success test is added to test_payment_multipart_trampoline. Another test, test_payment_trampoline_e2e, is updated to expect failure on 1 attempt and success on 2 attempts. These are test-suite maintenance changes, not production code fixes.
Changed components
tests/test_lnpeer.pyelectrum/trampoline.pyInspect captured patch +14 / −7
diff --git a/electrum/trampoline.py b/electrum/trampoline.py
index 3d38de4..08d0cf2 100644
--- a/electrum/trampoline.py
+++ b/electrum/trampoline.py
@@ -6,6 +6,8 @@ from fractions import Fraction
from typing import Mapping, Tuple, Optional, List, Iterable, Sequence, Set, Any, TYPE_CHECKING
from types import MappingProxyType
+import electrum_ecc as ecc
+
from .lnutil import LnFeatures, PaymentFeeBudget, FeeBudgetExceeded
from .lnonion import (
calc_hops_data_for_payment, new_onion_packet, OnionPacket, PER_HOP_HMAC_SIZE
diff --git a/tests/test_lnpeer.py b/tests/test_lnpeer.py
index c78b8ef..6686f6b 100644
--- a/tests/test_lnpeer.py
+++ b/tests/test_lnpeer.py
@@ -2598,14 +2598,8 @@ class TestPeerForwarding(TestPeer):
graph.workers['bob'].name: LNPeerAddr(host="127.0.0.1", port=9735, pubkey=graph.workers['bob'].node_keypair.pubkey),
graph.workers['carol'].name: LNPeerAddr(host="127.0.0.1", port=9735, pubkey=graph.workers['carol'].node_keypair.pubkey),
}
- # end-to-end trampoline: we attempt
- # * a payment with one trial: fails, because
- # we need at least one trial because the initial fees are too low
- # * a payment with several trials: should succeed
- with self.assertRaises(NoPathFound):
- await self._run_mpp(graph, {'alice_uses_trampoline': True, 'attempts': 1})
with self.assertRaises(PaymentDone):
- await self._run_mpp(graph,{'alice_uses_trampoline': True, 'attempts': 30})
+ await self._run_mpp(graph,{'alice_uses_trampoline': True, 'attempts': 1})
async def test_payment_multipart_trampoline_legacy(self):
graph = self.prepare_chans_and_peers_in_graph(self.GRAPH_DEFINITIONS['square_graph'])
@@ -2803,11 +2797,22 @@ class TestPeerForwarding(TestPeer):
inject_chan_into_gossipdb(
channel_db=graph.workers['bob'].channel_db, graph=graph,
node1name='carol', node2name='dave')
+ # end-to-end trampoline: we attempt
+ # * a payment with one trial: fails, because initial fees are too low
+ # * a payment with several trials: should succeed
+ with self.assertRaises(NoPathFound):
+ await self._run_trampoline_payment(
+ graph, sender_name='alice',
+ destination_name='edward',
+ trampoline_forwarders=('bob', 'dave'),
+ attempts=1,
+ )
with self.assertRaises(PaymentDone):
await self._run_trampoline_payment(
graph, sender_name='alice',
destination_name='edward',
trampoline_forwarders=('bob', 'dave'),
+ attempts=2,
)
async def test_payment_trampoline_e2e_lazy(self):
Why this scored 12/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.