1
0

Fix assertion error in ln payments when using same seed in multiple wallets.

Make path calculation check if channel is not in our sending channels but still uses our nodeID as starting node of the path.

I noticed an assertion error when trying to pay an invoice from a seed i have opened channels with in different wallet instances (same seed, different wallet).
Because the channel seemed suitable for sending the payment path finding included the channel for sending in the first position of the route but then
in pay_to_route the channel for route[0] could not be found as it is not included in our channel list, causing the assert and payment to fail.
This commit is contained in:
f321x
2025-04-11 12:42:54 +02:00
parent c5e9ef558f
commit f1900e493d

View File

@@ -526,7 +526,7 @@ class LNPathFinder(Logger):
def get_shortest_path_hops( def get_shortest_path_hops(
self, self,
*, *,
nodeA: bytes, nodeA: bytes, # nodeA is expected to be our node id if channels are passed in my_sending_channels
nodeB: bytes, nodeB: bytes,
invoice_amount_msat: int, invoice_amount_msat: int,
my_sending_channels: Dict[ShortChannelID, 'Channel'] = None, my_sending_channels: Dict[ShortChannelID, 'Channel'] = None,
@@ -589,10 +589,11 @@ class LNPathFinder(Logger):
if not node_filter(edge_startnode, node_info): if not node_filter(edge_startnode, node_info):
continue continue
is_mine = edge_channel_id in my_sending_channels is_mine = edge_channel_id in my_sending_channels
if is_mine: if edge_startnode == nodeA and my_sending_channels: # payment outgoing, on our channel
if edge_startnode == nodeA: # payment outgoing, on our channel if edge_channel_id not in my_sending_channels:
if not my_sending_channels[edge_channel_id].can_pay(amount_msat, check_frozen=True): continue
continue if not my_sending_channels[edge_channel_id].can_pay(amount_msat, check_frozen=True):
continue
edge_cost, fee_for_edge_msat = self._edge_cost( edge_cost, fee_for_edge_msat = self._edge_cost(
short_channel_id=edge_channel_id, short_channel_id=edge_channel_id,
start_node=edge_startnode, start_node=edge_startnode,