| 119 | } |
| 120 | |
| 121 | struct txwatch *watch_txid(const tal_t *ctx, |
| 122 | struct chain_topology *topo, |
| 123 | struct channel *channel, |
| 124 | const struct bitcoin_txid *txid, |
| 125 | enum watch_result (*cb)(struct lightningd *ld, |
| 126 | struct channel *, |
| 127 | const struct bitcoin_txid *, |
| 128 | const struct bitcoin_tx *, |
| 129 | unsigned int depth)) |
| 130 | { |
| 131 | struct txwatch *w; |
| 132 | |
| 133 | w = tal(ctx, struct txwatch); |
| 134 | w->topo = topo; |
| 135 | w->depth = 0; |
| 136 | w->txid = *txid; |
| 137 | w->tx = NULL; |
| 138 | w->channel = channel; |
| 139 | w->cb = cb; |
| 140 | |
| 141 | txwatch_hash_add(&w->topo->txwatches, w); |
| 142 | tal_add_destructor(w, destroy_txwatch); |
| 143 | |
| 144 | return w; |
| 145 | } |
| 146 | |
| 147 | struct txwatch *find_txwatch(struct chain_topology *topo, |
| 148 | const struct bitcoin_txid *txid, |
no outgoing calls
no test coverage detected