From 5081a832456246fec5b7e23c59ce135a154b54fd Mon Sep 17 00:00:00 2001 From: bitromortac Date: Thu, 25 Feb 2021 08:08:47 +0100 Subject: [PATCH 1/2] mpp_split: undo side effect in tearDown --- electrum/tests/test_mpp_split.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electrum/tests/test_mpp_split.py b/electrum/tests/test_mpp_split.py index b690f3109..252f04411 100644 --- a/electrum/tests/test_mpp_split.py +++ b/electrum/tests/test_mpp_split.py @@ -13,8 +13,6 @@ class TestMppSplit(ElectrumTestCase): super().setUp() # to make tests reproducible: random.seed(0) - # undo side effect - mpp_split.PART_PENALTY = PART_PENALTY self.channels_with_funds = { 0: 1_000_000_000, 1: 500_000_000, @@ -22,6 +20,11 @@ class TestMppSplit(ElectrumTestCase): 3: 101_000_000, } + def tearDown(self): + super().tearDown() + # undo side effect + mpp_split.PART_PENALTY = PART_PENALTY + def test_suggest_splits(self): with self.subTest(msg="do a payment with the maximal amount spendable over a single channel"): splits = mpp_split.suggest_splits(1_000_000_000, self.channels_with_funds, exclude_single_parts=True) From bf87169469a7fb4057e6e9a798d46decf54d7436 Mon Sep 17 00:00:00 2001 From: bitromortac Date: Thu, 25 Feb 2021 08:37:39 +0100 Subject: [PATCH 2/2] mpp_split: tweak split parameters Increases STARTING_CONFIGS to sample more starting configurations. Reduces CANDIDATES_PER_LEVEL to reduce computational effort. Increases REDISTRIBUTE. The time it takes for a typical suggest_split call is about 2 msec a desktop machine. --- electrum/mpp_split.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/electrum/mpp_split.py b/electrum/mpp_split.py index 3eafe7ee7..3659884ae 100644 --- a/electrum/mpp_split.py +++ b/electrum/mpp_split.py @@ -12,9 +12,9 @@ REDISTRIBUTION_FRACTION = 10 SPLIT_FRACTION = 10 # these parameters affect the computational work in the probabilistic algorithm -STARTING_CONFIGS = 30 -CANDIDATES_PER_LEVEL = 20 -REDISTRIBUTE = 5 +STARTING_CONFIGS = 50 +CANDIDATES_PER_LEVEL = 10 +REDISTRIBUTE = 10 def unique_hierarchy(hierarchy: Dict[int, List[Dict[bytes, int]]]) -> Dict[int, List[Dict[bytes, int]]]: