Merge pull request #9845 from f321x/fix_exclude_single_channel_splits
fix: suggest_splits exclude single channel splits
This commit is contained in:
@@ -82,14 +82,10 @@ def remove_single_part_configs(configs: List[SplitConfig]) -> List[SplitConfig]:
|
|||||||
|
|
||||||
|
|
||||||
def remove_single_channel_splits(configs: List[SplitConfig]) -> List[SplitConfig]:
|
def remove_single_channel_splits(configs: List[SplitConfig]) -> List[SplitConfig]:
|
||||||
filtered = []
|
return [
|
||||||
for config in configs:
|
config for config in configs
|
||||||
for v in config.values():
|
if all(len(channel_splits) <= 1 for channel_splits in config.values())
|
||||||
if len(v) > 1:
|
]
|
||||||
continue
|
|
||||||
filtered.append(config)
|
|
||||||
return filtered
|
|
||||||
|
|
||||||
|
|
||||||
def rate_config(
|
def rate_config(
|
||||||
config: SplitConfig,
|
config: SplitConfig,
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ class TestMppSplit(ElectrumTestCase):
|
|||||||
# check that the whole amount has been split on this channel
|
# check that the whole amount has been split on this channel
|
||||||
self.assertEqual(sum(split.config[(b"0", b"0")]), 1_000_000_000)
|
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):
|
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)
|
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:
|
for split in splits:
|
||||||
|
|||||||
Reference in New Issue
Block a user