paymod: Do not wait for a blockheight if we're already there

We want to differentiate a wrong block-height from other failure reasons, such
as an unknown `payment_hash`, so we skip the `waitblockheight` if we're
already at the correct height.
This commit is contained in:
Christian Decker
2020-06-17 13:51:00 +02:00
parent 5601a1ab21
commit 2649de54f2

View File

@@ -1990,6 +1990,13 @@ static void waitblockheight_cb(void *d, struct payment *p)
return payment_continue(p);
}
/* If we are already at the desired blockheight there is no point in
* waiting, and it is likely just some other error. Notice that
* start_block gets set by the initial getinfo call for each
* attempt.*/
if (blockheight < p->start_block)
return payment_continue(p);
plugin_log(p->plugin, LOG_INFORM,
"Remote node appears to be on a longer chain, which causes "
"CLTV timeouts to be incorrect. Waiting up to %" PRIu64