Check tx inputs against a single outpoint watch (rescan path). */
| 113 | |
| 114 | /* Check tx inputs against a single outpoint watch (rescan path). */ |
| 115 | static void check_tx_outpoint(struct command *cmd, |
| 116 | const struct bitcoin_tx *tx, |
| 117 | const struct watch *w, |
| 118 | u32 blockheight, |
| 119 | const struct bitcoin_blkid *blockhash, |
| 120 | u32 txindex) |
| 121 | { |
| 122 | for (size_t i = 0; i < tx->wtx->num_inputs; i++) { |
| 123 | struct bitcoin_outpoint outpoint; |
| 124 | |
| 125 | bitcoin_tx_input_get_txid(tx, i, &outpoint.txid); |
| 126 | outpoint.n = tx->wtx->inputs[i].index; |
| 127 | |
| 128 | if (bitcoin_outpoint_eq(&outpoint, &w->key.outpoint)) { |
| 129 | bwatch_send_watch_found(cmd, tx, blockheight, w, |
| 130 | txindex, i); |
| 131 | return; /* an outpoint can only be spent once */ |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /* Dispatch a single watch against one tx (rescan path). */ |
| 137 | static void check_tx_for_single_watch(struct command *cmd, |
no test coverage detected