From 187ea80688b58842f0f6c8eff9db0673d4643aa3 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 19 Mar 2026 09:28:19 +0100 Subject: [PATCH] lazy_trampoline: adapt unit test --- electrum/trampoline.py | 2 ++ tests/test_lnpeer.py | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/electrum/trampoline.py b/electrum/trampoline.py index 3d38de4ea..08d0cf28c 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 c78b8ef34..6686f6bc5 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):