Check all scriptpubkey watches via hash lookup */
| 15 | |
| 16 | /* Check all scriptpubkey watches via hash lookup */ |
| 17 | static void check_scriptpubkey_watches(struct command *cmd, |
| 18 | struct bwatch *bwatch, |
| 19 | const struct bitcoin_tx *tx, |
| 20 | u32 blockheight, |
| 21 | const struct bitcoin_blkid *blockhash, |
| 22 | u32 txindex) |
| 23 | { |
| 24 | struct bitcoin_txid txid; |
| 25 | |
| 26 | bitcoin_txid(tx, &txid); |
| 27 | |
| 28 | for (size_t i = 0; i < tx->wtx->num_outputs; i++) { |
| 29 | struct watch *w; |
| 30 | struct scriptpubkey k = { |
| 31 | .script = tx->wtx->outputs[i].script, |
| 32 | .len = tx->wtx->outputs[i].script_len |
| 33 | }; |
| 34 | |
| 35 | w = scriptpubkey_watches_get(bwatch->scriptpubkey_watches, &k); |
| 36 | if (!w) |
| 37 | continue; |
| 38 | if (w->start_block != UINT32_MAX |
| 39 | && blockheight < w->start_block) { |
| 40 | plugin_log(cmd->plugin, LOG_BROKEN, |
| 41 | "Watch for script %s on height >= %u found on block %u???", |
| 42 | tal_hexstr(tmpctx, k.script, k.len), |
| 43 | w->start_block, blockheight); |
| 44 | continue; |
| 45 | } |
| 46 | bwatch_send_watch_found(cmd, tx, blockheight, w, txindex, i); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /* Check all outpoint watches via hash lookup */ |
| 51 | static void check_outpoint_watches(struct command *cmd, |
no test coverage detected