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

Function json_disableoffer

lightningd/offer.c:235–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233AUTODATA(json_command, &listoffers_command);
234
235static struct command_result *json_disableoffer(struct command *cmd,
236 const char *buffer,
237 const jsmntok_t *obj UNNEEDED,
238 const jsmntok_t *params)
239{
240 struct json_stream *response;
241 struct sha256 *offer_id;
242 struct wallet *wallet = cmd->ld->wallet;
243 const char *b12;
244 const struct json_escape *label;
245 enum offer_status status;
246
247 if (!param(cmd, buffer, params,
248 p_req("offer_id", param_sha256, &offer_id),
249 NULL))
250 return command_param_failed();
251
252 b12 = wallet_offer_find(tmpctx, wallet, offer_id, &label, &status);
253 if (!b12)
254 return command_fail(cmd, LIGHTNINGD, "Unknown offer");
255
256 if (!offer_status_active(status))
257 return command_fail(cmd, OFFER_ALREADY_DISABLED,
258 "offer is not active");
259 status = wallet_offer_disable(wallet, offer_id, status);
260
261 response = json_stream_success(cmd);
262 json_populate_offer(response, offer_id, b12,
263 offer_str_nosig(tmpctx,
264 cmd->ld, b12),
265 label, status);
266 return command_success(cmd, response);
267}
268
269static const struct json_command disableoffer_command = {
270 "disableoffer",

Callers

nothing calls this directly

Calls 10

offer_status_activeFunction · 0.85
wallet_offer_disableFunction · 0.85
json_populate_offerFunction · 0.85
offer_str_nosigFunction · 0.85
command_param_failedFunction · 0.70
command_failFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50
wallet_offer_findFunction · 0.50

Tested by

no test coverage detected