paymod: Add a simple test-command to test the paymod state-machine

This commit can be reverted/skipped once we have implemented all the logic and
have feature parity with the normal `pay`. It's main purpose is to expose the
unfinished functionality to test it, without completely breaking the existing
`pay` command.
This commit is contained in:
Christian Decker
2020-05-08 15:03:48 +02:00
parent 5d1725209d
commit 23b4dca3c7
4 changed files with 110 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
#include <plugins/libplugin-pay.h>
#include <stdio.h>
struct payment *payment_new(tal_t *ctx, struct command *cmd,
struct payment *parent,
@@ -144,3 +145,19 @@ void payment_continue(struct payment *p)
* `payment_continue` after the final state. */
abort();
}
static inline struct dummy_data *
dummy_data_init(struct payment *p)
{
return tal(p, struct dummy_data);
}
static inline void dummy_step_cb(struct dummy_data *dd,
struct payment *p)
{
fprintf(stderr, "dummy_step_cb called for payment %p at step %d\n", p, p->step);
payment_continue(p);
}
REGISTER_PAYMENT_MODIFIER(dummy, struct dummy_data *, dummy_data_init,
dummy_step_cb);