From 95c55c542e3e8720e18cf92c42a90789a21be3e8 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 15 Jan 2024 20:11:08 +0000 Subject: [PATCH] lnworker.suggest_splits: (fix) don't force splitting lnworker.suggest_splits for non-trampoline case tries to split amts over 5000 sat but mpp_split.suggest_splits does not return splits where any part is smaller than 10000 sat. So in practice, without trampoline, invoices between 5k and ~20k sats could not be paid. This suggests that the logic should not be scattered in multiple places but merged into mpp_split.py... This commit just does a quick fix though, to try again without splitting if there was no solution. --- electrum/lnworker.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 5cb0b15d3..17d9ccd6b 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1890,13 +1890,20 @@ class LNWallet(LNWorker): if (amount_msat / final_total_msat > self.MPP_SPLIT_PART_FRACTION and amount_msat > self.MPP_SPLIT_PART_MINAMT_MSAT): exclude_single_part_payments = True - split_configurations = suggest_splits( - amount_msat, - channels_with_funds, - exclude_single_part_payments=exclude_single_part_payments, - exclude_multinode_payments=exclude_multinode_payments, - exclude_single_channel_splits=exclude_single_channel_splits - ) + + def get_splits(): + return suggest_splits( + amount_msat, + channels_with_funds, + exclude_single_part_payments=exclude_single_part_payments, + exclude_multinode_payments=exclude_multinode_payments, + exclude_single_channel_splits=exclude_single_channel_splits + ) + + split_configurations = get_splits() + if not split_configurations and exclude_single_part_payments: + exclude_single_part_payments = False + split_configurations = get_splits() self.logger.info(f'suggest_split {amount_msat} returned {len(split_configurations)} configurations') return split_configurations