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

Function json_bwatch_add_outpoint

plugins/bwatch/bwatch_interface.c:392–415  ·  view source on GitHub ↗

Register an outpoint (txid + outnum) watch for `owner` from * `start_block` onwards. */

Source from the content-addressed store, hash-verified

390/* Register an outpoint (txid + outnum) watch for `owner` from
391 * `start_block` onwards. */
392struct command_result *json_bwatch_add_outpoint(struct command *cmd,
393 const char *buffer,
394 const jsmntok_t *params)
395{
396 struct bwatch *bwatch = bwatch_of(cmd->plugin);
397 const char *owner;
398 struct bitcoin_outpoint *outpoint;
399 u32 *start_block;
400 struct watch *w;
401
402 if (!param(cmd, buffer, params,
403 p_req("owner", param_string, &owner),
404 p_req("outpoint", param_outpoint, &outpoint),
405 p_req("start_block", param_u32, &start_block),
406 NULL))
407 return command_param_failed();
408
409 /* New owner is appended to the watch's owner list; same owner
410 * re-adding lowers start_block if needed. */
411 w = bwatch_add_watch(cmd, bwatch, WATCH_OUTPOINT,
412 outpoint, NULL, NULL, NULL,
413 *start_block, owner);
414 return add_watch_and_maybe_rescan(cmd, bwatch, w, *start_block);
415}
416
417/* Drop one owner from an outpoint watch; the watch itself goes away
418 * 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