Browse Source

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.
master
Christian Decker 4 years ago
parent
commit
e677486fcc
  1. 5
      plugins/pay.c

5
plugins/pay.c

@ -2105,6 +2105,11 @@ static struct command_result *json_paymod(struct command *cmd,
p->amount = *msat; 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->local_id = &my_id;
p->json_buffer = tal_steal(p, buf); p->json_buffer = tal_steal(p, buf);
p->json_toks = params; p->json_toks = params;

Loading…
Cancel
Save