lazy_trampoline: adapt unit test
This commit is contained in:
@@ -6,6 +6,8 @@ from fractions import Fraction
|
|||||||
from typing import Mapping, Tuple, Optional, List, Iterable, Sequence, Set, Any, TYPE_CHECKING
|
from typing import Mapping, Tuple, Optional, List, Iterable, Sequence, Set, Any, TYPE_CHECKING
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
|
|
||||||
|
import electrum_ecc as ecc
|
||||||
|
|
||||||
from .lnutil import LnFeatures, PaymentFeeBudget, FeeBudgetExceeded
|
from .lnutil import LnFeatures, PaymentFeeBudget, FeeBudgetExceeded
|
||||||
from .lnonion import (
|
from .lnonion import (
|
||||||
calc_hops_data_for_payment, new_onion_packet, OnionPacket, PER_HOP_HMAC_SIZE
|
calc_hops_data_for_payment, new_onion_packet, OnionPacket, PER_HOP_HMAC_SIZE
|
||||||
|
|||||||
+12
-7
@@ -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['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),
|
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):
|
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):
|
async def test_payment_multipart_trampoline_legacy(self):
|
||||||
graph = self.prepare_chans_and_peers_in_graph(self.GRAPH_DEFINITIONS['square_graph'])
|
graph = self.prepare_chans_and_peers_in_graph(self.GRAPH_DEFINITIONS['square_graph'])
|
||||||
@@ -2803,11 +2797,22 @@ class TestPeerForwarding(TestPeer):
|
|||||||
inject_chan_into_gossipdb(
|
inject_chan_into_gossipdb(
|
||||||
channel_db=graph.workers['bob'].channel_db, graph=graph,
|
channel_db=graph.workers['bob'].channel_db, graph=graph,
|
||||||
node1name='carol', node2name='dave')
|
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):
|
with self.assertRaises(PaymentDone):
|
||||||
await self._run_trampoline_payment(
|
await self._run_trampoline_payment(
|
||||||
graph, sender_name='alice',
|
graph, sender_name='alice',
|
||||||
destination_name='edward',
|
destination_name='edward',
|
||||||
trampoline_forwarders=('bob', 'dave'),
|
trampoline_forwarders=('bob', 'dave'),
|
||||||
|
attempts=2,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def test_payment_trampoline_e2e_lazy(self):
|
async def test_payment_trampoline_e2e_lazy(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user