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

Function json_bwatch_add_scid

plugins/bwatch/bwatch_interface.c:441–464  ·  view source on GitHub ↗

Register a short_channel_id watch for `owner` from `start_block` * onwards. The scid pins the watch to one specific (block, txindex, * outnum). */

Source from the content-addressed store, hash-verified

439 * onwards. The scid pins the watch to one specific (block, txindex,
440 * outnum). */
441struct command_result *json_bwatch_add_scid(struct command *cmd,
442 const char *buffer,
443 const jsmntok_t *params)
444{
445 struct bwatch *bwatch = bwatch_of(cmd->plugin);
446 const char *owner;
447 struct short_channel_id *scid;
448 u32 *start_block;
449 struct watch *w;
450
451 if (!param(cmd, buffer, params,
452 p_req("owner", param_string, &owner),
453 p_req("scid", param_short_channel_id, &scid),
454 p_req("start_block", param_u32, &start_block),
455 NULL))
456 return command_param_failed();
457
458 /* New owner is appended to the watch's owner list; same owner
459 * re-adding lowers start_block if needed. */
460 w = bwatch_add_watch(cmd, bwatch, WATCH_SCID,
461 NULL, NULL, scid, NULL,
462 *start_block, owner);
463 return add_watch_and_maybe_rescan(cmd, bwatch, w, *start_block);
464}
465
466/* Drop one owner from a scid watch; the watch itself goes away once
467 * the last owner is removed. */

Callers

nothing calls this directly

Calls 5

bwatch_ofFunction · 0.85
bwatch_add_watchFunction · 0.85
paramFunction · 0.50
command_param_failedFunction · 0.50

Tested by

no test coverage detected