MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_disableinvoicerequest

Function json_disableinvoicerequest

lightningd/offer.c:667–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665AUTODATA(json_command, &listinvoicerequests_command);
666
667static struct command_result *json_disableinvoicerequest(struct command *cmd,
668 const char *buffer,
669 const jsmntok_t *obj UNNEEDED,
670 const jsmntok_t *params)
671{
672 struct json_stream *response;
673 struct sha256 *invreq_id;
674 struct wallet *wallet = cmd->ld->wallet;
675 const char *b12;
676 const struct json_escape *label;
677 enum offer_status status;
678
679 if (!param_check(cmd, buffer, params,
680 p_req("invreq_id", param_sha256, &invreq_id),
681 NULL))
682 return command_param_failed();
683
684 b12 = wallet_invoice_request_find(tmpctx, wallet, invreq_id,
685 &label, &status);
686 if (!b12)
687 return command_fail(cmd, LIGHTNINGD, "Unknown invoice_request");
688
689 if (!offer_status_active(status))
690 return command_fail(cmd, OFFER_ALREADY_DISABLED,
691 "invoice_request is not active");
692
693 if (command_check_only(cmd))
694 return command_check_done(cmd);
695
696 status = wallet_invoice_request_disable(wallet, invreq_id, status);
697
698 response = json_stream_success(cmd);
699 json_populate_invreq(response, invreq_id, b12, label, status);
700 return command_success(cmd, response);
701}
702
703static const struct json_command disableinvoicerequest_command = {
704 "disableinvoicerequest",

Callers

nothing calls this directly

Calls 11

param_checkFunction · 0.85
offer_status_activeFunction · 0.85
json_populate_invreqFunction · 0.85
command_param_failedFunction · 0.70
command_failFunction · 0.70
command_check_onlyFunction · 0.70
command_check_doneFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70

Tested by

no test coverage detected