Skip to content

Commit a984202

Browse files
committed
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 <[email protected]>
1 parent 32f5ae8 commit a984202

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/renepay/flow.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,10 @@ void chan_extra_cannot_send(
220220
oldmax = ce->half[scidd->dir].known_max;
221221

222222
/* If we "knew" the capacity was at least this, we just showed we're wrong! */
223-
if (amount_msat_less(x, ce->half[scidd->dir].known_min))
224-
ce->half[scidd->dir].known_min = AMOUNT_MSAT(0);
223+
if (amount_msat_less(x, ce->half[scidd->dir].known_min)) {
224+
/* Skip to half of x, since we don't know (rounds down) */
225+
ce->half[scidd->dir].known_min = amount_msat_div(x, 2);
226+
}
225227

226228
ce->half[scidd->dir].known_max = amount_msat_min(ce->half[scidd->dir].known_max,x);
227229

0 commit comments

Comments
 (0)