1
0

lnpeer: replace assert active_forwarding with if. force both incoming and outgoing MPP in test_mpp_consolidation

This commit is contained in:
ThomasV
2025-01-06 11:09:45 +01:00
parent 33d0e6dbec
commit ebff5b545d
2 changed files with 4 additions and 3 deletions

View File

@@ -2801,8 +2801,8 @@ class Peer(Logger, EventListener):
self.lnworker.active_forwardings[payment_key].append(next_htlc)
self.lnworker.downstream_to_upstream_htlc[next_htlc] = htlc_key
except OnionRoutingFailure as e:
assert len(self.lnworker.active_forwardings[payment_key]) == 0
self.lnworker.save_forwarding_failure(payment_key, failure_message=e)
if len(self.lnworker.active_forwardings[payment_key]) == 0:
self.lnworker.save_forwarding_failure(payment_key, failure_message=e)
# TODO what about other errors? e.g. TxBroadcastError for a swap.
# - malicious electrum server could fake TxBroadcastError
# Could we "catch-all Exception" and fail back the htlcs with e.g. TEMPORARY_NODE_FAILURE?

View File

@@ -1950,7 +1950,8 @@ class TestPeerForwarding(TestPeer):
graph = self.prepare_chans_and_peers_in_graph(graph_definition)
if test_mpp_consolidation:
graph.workers['dave'].features |= LnFeatures.BASIC_MPP_OPT
graph.workers['alice'].network.config.TEST_FORCE_MPP = True
graph.workers['alice'].network.config.TEST_FORCE_MPP = True # trampoline must wait until all incoming htlcs are received before sending outgoing htlcs
graph.workers['bob'].network.config.TEST_FORCE_MPP = True # trampoline must wait until all outgoing htlcs have failed before failing incoming htlcs
if is_legacy:
# turn off trampoline features in invoice
graph.workers['dave'].features = graph.workers['dave'].features ^ LnFeatures.OPTION_TRAMPOLINE_ROUTING_OPT_ELECTRUM