lazy_trampoline: adapt unit test

This commit is contained in:
ThomasV
2026-03-19 09:28:19 +01:00
parent f3a8dd61bb
commit 187ea80688
2 changed files with 14 additions and 7 deletions
+2
View File
@@ -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
+12 -7
View File
@@ -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):