From 684d6dff5037fee24c4970593e265814be0affc5 Mon Sep 17 00:00:00 2001 From: Lagrang3 Date: Wed, 14 Aug 2024 21:08:33 +0100 Subject: [PATCH] renepay: patch to assertion htlc_total<=known_max In theory we should not have htlc_total<=known_max. But for some strange race condition we do sometimes. Until we find a solution to ensure the correct state of the uncertainty network we remove the assertion. Thanks to signed arithmetic and MIN guards, the rest of the code in linearize_channel can handle the weird cases with known_max --- plugins/renepay/mcf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/renepay/mcf.c b/plugins/renepay/mcf.c index 5bb6387b5..74c668295 100644 --- a/plugins/renepay/mcf.c +++ b/plugins/renepay/mcf.c @@ -470,8 +470,14 @@ static bool linearize_channel(const struct pay_parameters *params, return false; } - assert( - amount_msat_less_eq(extra_half->htlc_total, extra_half->known_max)); + /* FIXME: this assertion has been reported to be triggered in issue + * #7535. A quick and dirty solution is to comment it and work-around + * this case. But in principle if we do things the right way we should + * not have htlc_total>known_max. The problem is likely to be + * asynchronous way in which reserved htlcs are removed and known_max is + * updated. */ + // assert( + // amount_msat_less_eq(extra_half->htlc_total, extra_half->known_max)); assert( amount_msat_less_eq(extra_half->known_min, extra_half->known_max));