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

Function check_tx_outpoint

plugins/bwatch/bwatch_scanner.c:115–134  ·  view source on GitHub ↗

Check tx inputs against a single outpoint watch (rescan path). */

Source from the content-addressed store, hash-verified

113
114/* Check tx inputs against a single outpoint watch (rescan path). */
115static 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). */
137static void check_tx_for_single_watch(struct command *cmd,

Callers 1

Calls 2

bwatch_send_watch_foundFunction · 0.85

Tested by

no test coverage detected