paymod: Add function to set the current step

This is necessary otherwise we would not be calling modifiers for the newly
set state which can lead to unexpected results.
This commit is contained in:
Christian Decker
2020-06-09 15:52:50 +02:00
parent 4aed45e98d
commit 4b3e849ce9
2 changed files with 26 additions and 4 deletions

View File

@@ -344,6 +344,16 @@ struct payment *payment_new(tal_t *ctx, struct command *cmd,
void payment_start(struct payment *p);
void payment_continue(struct payment *p);
/**
* Set the payment to the current step.
*
* This must be used by modifiers if they want to skip to a specific step. It
* ensures that the internal state is reset correctly and that all modifier
* callbacks are called once `payment_continue` is called again.
*/
void payment_set_step(struct payment *p, enum payment_step newstep);
/* Fails a partial payment and continues with the core flow. */
void payment_fail(struct payment *p, const char *fmt, ...) PRINTF_FMT(2,3);