Register a scriptpubkey watch for `owner` from `start_block` onwards. */
| 342 | |
| 343 | /* Register a scriptpubkey watch for `owner` from `start_block` onwards. */ |
| 344 | struct 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. */ |
nothing calls this directly
no test coverage detected