From b80b746cd9e63622bb9d2e38678e11b3da72cb2f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 25 May 2021 11:31:00 +0930 Subject: [PATCH] pay: don't wait forever if we're already past deadline. I don't know why it thinks that blockheight is INT_MAX, but we shouldn't wait forever anyway. ``` lightningd-1: 2021-05-25T01:22:19.472Z DEBUG plugin-pay: cmd 67 partid 0: Blockheight disagreement, not aborting. lightningd-1: 2021-05-25T01:22:19.483Z INFO plugin-pay: cmd 67 partid 0: failed: WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS (reply from remote) lightningd-1: 2021-05-25T01:22:19.483Z INFO plugin-pay: cmd 67 partid 0: Remote node appears to be on a longer chain, which causes CLTV timeouts to be incorrect. Waiting up to 49 seconds to catch up to block 2147483647 before retrying. lightningd-1: 2021-05-25T01:23:08.489Z INFO plugin-pay: cmd 67 partid 0: Timed out while attempting to sync to blockheight returned by destination. Please finish syncing with the blockchain and try again. lightningd-1: 2021-05-25T01:23:08.489Z INFO plugin-pay: cmd 67 partid 0: Remote node appears to be on a longer chain, which causes CLTV timeouts to be incorrect. Waiting up to 18446744073709551615 seconds to catch up to block 2147483647 before retrying. ``` Signed-off-by: Rusty Russell --- plugins/libplugin-pay.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 496ea0766..d8a2d53b3 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -3264,6 +3264,9 @@ static void waitblockheight_cb(void *d, struct payment *p) /* Check if we'd be waiting more than 0 seconds. If we have * less than a second then waitblockheight would return * immediately resulting in a loop. */ + if (time_after(now, p->deadline)) + return payment_continue(p); + remaining = time_between(p->deadline, now); if (time_to_sec(remaining) < 1) return payment_continue(p);