Send watch_found notification to lightningd. */
| 26 | |
| 27 | /* Send watch_found notification to lightningd. */ |
| 28 | void 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). */ |
no test coverage detected