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

Function json_bwatch_add_scriptpubkey

plugins/bwatch/bwatch_interface.c:344–367  ·  view source on GitHub ↗

Register a scriptpubkey watch for `owner` from `start_block` onwards. */

Source from the content-addressed store, hash-verified

342
343/* Register a scriptpubkey watch for `owner` from `start_block` onwards. */
344struct command_result *json_bwatch_add_scriptpubkey(struct command *cmd,
345 const char *buffer,
346 const jsmntok_t *params)
347{
348 struct bwatch *bwatch = bwatch_of(cmd->plugin);
349 const char *owner;
350 u8 *scriptpubkey;
351 u32 *start_block;
352 struct watch *w;
353
354 if (!param(cmd, buffer, params,
355 p_req("owner", param_string, &owner),
356 p_req("scriptpubkey", param_bin_from_hex, &scriptpubkey),
357 p_req("start_block", param_u32, &start_block),
358 NULL))
359 return command_param_failed();
360
361 /* New owner is appended to the watch's owner list; same owner
362 * re-adding lowers start_block if needed. */
363 w = bwatch_add_watch(cmd, bwatch, WATCH_SCRIPTPUBKEY,
364 NULL, scriptpubkey, NULL, NULL,
365 *start_block, owner);
366 return add_watch_and_maybe_rescan(cmd, bwatch, w, *start_block);
367}
368
369/* Drop one owner from a scriptpubkey watch; the watch itself goes away
370 * once 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