Browse Source

paymod: Reset the step if we're waiting for a block

This was causing the state flapping test to fail, since we were yielding
control of the io_loop, waiting for the blockheight to be reached, and not
setting the status beforehand. An interim `paystatus` call would then find a
failed leaf and deduce the entire payment failed. Setting it back to the
previous state keeps the overall payment pending while we wait.
paymod-04
Christian Decker 5 years ago
parent
commit
a43d030137
  1. 6
      plugins/libplugin-pay.c

6
plugins/libplugin-pay.c

@ -2016,6 +2016,12 @@ static void waitblockheight_cb(void *d, struct payment *p)
" seconds to catch up to block %d before retrying.",
time_to_sec(remaining), blockheight);
/* Set temporarily set the state of the payment to not failed, so
* interim status queries don't show this as terminally failed. We're
* in control for this payment so nobody else could be fooled by
* this. The callback will set it to retry anyway. */
payment_set_step(p, PAYMENT_STEP_RETRY);
req = jsonrpc_request_start(p->plugin, NULL, "waitblockheight",
waitblockheight_rpc_cb,
waitblockheight_rpc_cb, p);

Loading…
Cancel
Save