| 274 | } |
| 275 | |
| 276 | void watch_topology_changed(struct chain_topology *topo) |
| 277 | { |
| 278 | struct txwatch_hash_iter i; |
| 279 | struct txwatch *w; |
| 280 | |
| 281 | /* Iterating a htable during deletes is safe and consistent. |
| 282 | * Adding is forbidden. */ |
| 283 | txwatch_hash_lock(topo->txwatches); |
| 284 | for (w = txwatch_hash_first(topo->txwatches, &i); |
| 285 | w; |
| 286 | w = txwatch_hash_next(topo->txwatches, &i)) { |
| 287 | u32 depth; |
| 288 | |
| 289 | depth = get_tx_depth(topo, &w->txid); |
| 290 | if (depth) { |
| 291 | if (!w->tx) |
| 292 | w->tx = wallet_transaction_get(w, topo->ld->wallet, |
| 293 | &w->txid); |
| 294 | txw_fire(w, &w->txid, depth); |
| 295 | } |
| 296 | } |
| 297 | txwatch_hash_unlock(topo->txwatches); |
| 298 | } |
| 299 | |
| 300 | void txwatch_inform(const struct chain_topology *topo, |
| 301 | const struct bitcoin_txid *txid, |
no test coverage detected