plugins/renepay: don't drop min to 0 if it's shown wrong, but drop 50%.

Eduardo is on holiday right now, but he pinged me asking for this.  It
makes some sense, and using half the *failed value* covers the case where
it's less than half what we expected.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-08-22 06:22:13 +09:30
parent 32f5ae8d1f
commit a984202576

View file

@ -220,8 +220,10 @@ void chan_extra_cannot_send(
oldmax = ce->half[scidd->dir].known_max;
/* If we "knew" the capacity was at least this, we just showed we're wrong! */
if (amount_msat_less(x, ce->half[scidd->dir].known_min))
ce->half[scidd->dir].known_min = AMOUNT_MSAT(0);
if (amount_msat_less(x, ce->half[scidd->dir].known_min)) {
/* Skip to half of x, since we don't know (rounds down) */
ce->half[scidd->dir].known_min = amount_msat_div(x, 2);
}
ce->half[scidd->dir].known_max = amount_msat_min(ce->half[scidd->dir].known_max,x);