mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
pay: Check for self-payments before attempting to pay
This duplicates the check in libplugin-pay.c, with a more concise error message. Both are needed since pay may not be the only entrypoint.
This commit is contained in:
parent
9869083a79
commit
e677486fcc
@ -2105,6 +2105,11 @@ static struct command_result *json_paymod(struct command *cmd,
|
||||
p->amount = *msat;
|
||||
}
|
||||
|
||||
if (node_id_eq(&my_id, p->destination))
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"This payment is destined for ourselves. "
|
||||
"Self-payments are not supported");
|
||||
|
||||
p->local_id = &my_id;
|
||||
p->json_buffer = tal_steal(p, buf);
|
||||
p->json_toks = params;
|
||||
|
Loading…
Reference in New Issue
Block a user