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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-05-25 11:31:00 +09:30
committed by Christian Decker
parent 61d146a2e7
commit b80b746cd9

View File

@@ -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 /* Check if we'd be waiting more than 0 seconds. If we have
* less than a second then waitblockheight would return * less than a second then waitblockheight would return
* immediately resulting in a loop. */ * immediately resulting in a loop. */
if (time_after(now, p->deadline))
return payment_continue(p);
remaining = time_between(p->deadline, now); remaining = time_between(p->deadline, now);
if (time_to_sec(remaining) < 1) if (time_to_sec(remaining) < 1)
return payment_continue(p); return payment_continue(p);