routing: refine amount scaling

Mission control may have outdated success/failure amounts for node pairs
that have channels with differing capacities. In that case we assume to
still find the liquidity as before and rescale the amounts to the
according range.
This commit is contained in:
bitromortac committed 2025-05-02 10:30:28 +02:00
1 parent 5afb0de8a8
commit 07f863a2a5
2 files changed
+44 -12

No files matched your search

+20
View File
@@ -212,6 +212,26 @@ func TestSuccessProbability(t *testing.T) {
amount: largeAmount,
expectedProbability: 0.5,
},
// Larger success and larger failure than the old capacity are
// rescaled to still give a very high success rate.
{
name: "smaller cap, large success/fail",
capacity: capacity,
failAmount: 2*capacity + 1,
successAmount: 2 * capacity,
amount: largeAmount,
expectedProbability: 1.0,
},
// A lower success amount is not rescaled.
{
name: "smaller cap, large fail",
capacity: capacity,
successAmount: smallAmount / 2,
failAmount: 2 * capacity,
amount: smallAmount,
// See "previous success, larger amount".
expectedProbability: 0.851,
},
}
estimator := BimodalEstimator{