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

Function bwatch_send_watch_found

plugins/bwatch/bwatch_interface.c:28–61  ·  view source on GitHub ↗

Send watch_found notification to lightningd. */

Source from the content-addressed store, hash-verified

26
27/* Send watch_found notification to lightningd. */
28void bwatch_send_watch_found(struct command *cmd,
29 const struct bitcoin_tx *tx,
30 u32 blockheight,
31 const struct watch *w,
32 u32 txindex,
33 u32 index)
34{
35 struct command *aux = aux_command(cmd);
36 struct out_req *req;
37
38 req = jsonrpc_request_start(aux, "watch_found",
39 notify_ack, notify_ack, NULL);
40 /* tx==NULL signals "not found" for WATCH_SCID; omit tx+txindex so
41 * json_watch_found passes tx=NULL down to the handler. */
42 if (tx) {
43 json_add_tx(req->js, "tx", tx);
44 json_add_u32(req->js, "txindex", txindex);
45 if (index != UINT32_MAX)
46 json_add_u32(req->js, "index", index);
47 }
48 json_add_u32(req->js, "blockheight", blockheight);
49
50 /* Add owners array */
51 json_array_start(req->js, "owners");
52 for (size_t i = 0; i < tal_count(w->owners); i++)
53 json_add_string(req->js, NULL, w->owners[i]);
54 json_array_end(req->js);
55
56 /* Tests (and operators) key off this line; keep wording stable. */
57 plugin_log(cmd->plugin, LOG_DBG,
58 "watch_found at block %u", blockheight);
59
60 send_outreq(req);
61}
62
63/* Send a blockdepth depth notification to lightningd: same watch_found
64 * RPC shape but with depth + blockheight only (no tx). */

Callers 5

check_outpoint_watchesFunction · 0.85
check_tx_scriptpubkeyFunction · 0.85
check_tx_outpointFunction · 0.85
maybe_fire_scid_watchFunction · 0.85

Calls 8

json_add_txFunction · 0.85
json_add_u32Function · 0.85
json_array_startFunction · 0.85
json_array_endFunction · 0.85
aux_commandFunction · 0.50
json_add_stringFunction · 0.50
plugin_logFunction · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected