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

Function bwatch_send_blockdepth_found

plugins/bwatch/bwatch_interface.c:65–88  ·  view source on GitHub ↗

Send a blockdepth depth notification to lightningd: same watch_found * RPC shape but with depth + blockheight only (no tx). */

Source from the content-addressed store, hash-verified

63/* Send a blockdepth depth notification to lightningd: same watch_found
64 * RPC shape but with depth + blockheight only (no tx). */
65void bwatch_send_blockdepth_found(struct command *cmd,
66 const struct watch *w,
67 u32 depth,
68 u32 blockheight)
69{
70 struct command *aux = aux_command(cmd);
71 struct out_req *req;
72
73 req = jsonrpc_request_start(aux, "watch_found",
74 notify_ack, notify_ack, NULL);
75 json_add_u32(req->js, "blockheight", blockheight);
76 json_add_u32(req->js, "depth", depth);
77
78 json_array_start(req->js, "owners");
79 for (size_t i = 0; i < tal_count(w->owners); i++)
80 json_add_string(req->js, NULL, w->owners[i]);
81 json_array_end(req->js);
82
83 plugin_log(cmd->plugin, LOG_DBG,
84 "watch_found at block %u (blockdepth depth=%u)",
85 blockheight, depth);
86
87 send_outreq(req);
88}
89
90/* Tell one owner that a previously-reported watch_found was rolled back. */
91void bwatch_send_watch_revert(struct command *cmd,

Callers 1

Calls 7

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