mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 08:04:26 +01:00
paymod: Remove the dummy payment modifier
It was there only for demonstration purposes, and is no longer useful.
This commit is contained in:
@@ -984,22 +984,6 @@ void *payment_mod_get_data(const struct payment *p,
|
|||||||
abort();
|
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);
|
|
||||||
|
|
||||||
static struct retry_mod_data *retry_data_init(struct payment *p);
|
static struct retry_mod_data *retry_data_init(struct payment *p);
|
||||||
|
|
||||||
static inline void retry_step_cb(struct retry_mod_data *rd,
|
static inline void retry_step_cb(struct retry_mod_data *rd,
|
||||||
|
|||||||
@@ -257,16 +257,11 @@ void *payment_mod_get_data(const struct payment *payment,
|
|||||||
return payment_mod_get_data(p, &name##_pay_mod); \
|
return payment_mod_get_data(p, &name##_pay_mod); \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dummy_data {
|
|
||||||
unsigned int *dummy_param;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct retry_mod_data {
|
struct retry_mod_data {
|
||||||
int retries;
|
int retries;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* List of globally available payment modifiers. */
|
/* List of globally available payment modifiers. */
|
||||||
extern struct payment_modifier dummy_pay_mod;
|
|
||||||
REGISTER_PAYMENT_MODIFIER_HEADER(retry, struct retry_mod_data);
|
REGISTER_PAYMENT_MODIFIER_HEADER(retry, struct retry_mod_data);
|
||||||
|
|
||||||
/* For the root payment we can seed the channel_hints with the result from
|
/* For the root payment we can seed the channel_hints with the result from
|
||||||
|
|||||||
@@ -1726,8 +1726,7 @@ static void init(struct plugin *p,
|
|||||||
maxdelay_default = atoi(field);
|
maxdelay_default = atoi(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct payment_modifier *paymod_mods[4] = {
|
struct payment_modifier *paymod_mods[3] = {
|
||||||
&dummy_pay_mod,
|
|
||||||
&local_channel_hints_pay_mod,
|
&local_channel_hints_pay_mod,
|
||||||
&retry_pay_mod,
|
&retry_pay_mod,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -1744,16 +1743,12 @@ static struct command_result *json_paymod(struct command *cmd,
|
|||||||
const char *b11str;
|
const char *b11str;
|
||||||
struct bolt11 *b11;
|
struct bolt11 *b11;
|
||||||
char *fail;
|
char *fail;
|
||||||
struct dummy_data *ddata;
|
|
||||||
p = payment_new(NULL, cmd, NULL /* No parent */, paymod_mods);
|
p = payment_new(NULL, cmd, NULL /* No parent */, paymod_mods);
|
||||||
|
|
||||||
ddata = (struct dummy_data*)p->modifier_data[0];
|
|
||||||
|
|
||||||
/* If any of the modifiers need to add params to the JSON-RPC call we
|
/* If any of the modifiers need to add params to the JSON-RPC call we
|
||||||
* would add them to the `param()` call below, and have them be
|
* would add them to the `param()` call below, and have them be
|
||||||
* initialized directly that way. */
|
* initialized directly that way. */
|
||||||
if (!param(cmd, buf, params, p_req("bolt11", param_string, &b11str),
|
if (!param(cmd, buf, params, p_req("bolt11", param_string, &b11str),
|
||||||
p_opt_def("dummy", param_number, &ddata->dummy_param, 42),
|
|
||||||
NULL))
|
NULL))
|
||||||
return command_param_failed();
|
return command_param_failed();
|
||||||
|
|
||||||
|
|||||||
@@ -3053,7 +3053,7 @@ def test_pay_modifiers(node_factory):
|
|||||||
# Make sure that the dummy param is in the help (and therefore assigned to
|
# Make sure that the dummy param is in the help (and therefore assigned to
|
||||||
# the modifier data).
|
# the modifier data).
|
||||||
hlp = l1.rpc.help("paymod")['help'][0]
|
hlp = l1.rpc.help("paymod")['help'][0]
|
||||||
assert(hlp['command'] == 'paymod bolt11 [dummy]')
|
assert(hlp['command'] == 'paymod bolt11')
|
||||||
|
|
||||||
inv = l2.rpc.invoice(123, 'lbl', 'desc')['bolt11']
|
inv = l2.rpc.invoice(123, 'lbl', 'desc')['bolt11']
|
||||||
r = l1.rpc.paymod(inv)
|
r = l1.rpc.paymod(inv)
|
||||||
|
|||||||
Reference in New Issue
Block a user