1
0

fix: suggest_splits exclude single channel splits

This commit is contained in:
f321x
2025-05-20 12:48:28 +02:00
parent d1917b2951
commit cfdaafdd52
2 changed files with 10 additions and 8 deletions

View File

@@ -82,14 +82,10 @@ def remove_single_part_configs(configs: List[SplitConfig]) -> List[SplitConfig]:
def remove_single_channel_splits(configs: List[SplitConfig]) -> List[SplitConfig]:
filtered = []
for config in configs:
for v in config.values():
if len(v) > 1:
continue
filtered.append(config)
return filtered
return [
config for config in configs
if all(len(channel_splits) <= 1 for channel_splits in config.values())
]
def rate_config(
config: SplitConfig,

View File

@@ -87,6 +87,12 @@ class TestMppSplit(ElectrumTestCase):
# check that the whole amount has been split on this channel
self.assertEqual(sum(split.config[(b"0", b"0")]), 1_000_000_000)
with self.subTest(msg="test exclude single channel splits"):
splits = mpp_split.suggest_splits(1_000_000_000, self.channels_with_funds, exclude_single_channel_splits=True)
for split in splits:
for channel_split in split.config.values():
assert len(channel_split) <= 1, split
def test_send_to_single_node(self):
splits = mpp_split.suggest_splits(1_000_000_000, self.channels_with_funds, exclude_single_part_payments=False, exclude_multinode_payments=True)
for split in splits: