| 280 | } |
| 281 | |
| 282 | void watch_topology_changed(struct chain_topology *topo) |
| 283 | { |
| 284 | struct txwatch_hash_iter i; |
| 285 | struct txwatch *w; |
| 286 | bool needs_rerun; |
| 287 | do { |
| 288 | /* Iterating a htable during deletes is safe, but might skip entries. */ |
| 289 | needs_rerun = false; |
| 290 | for (w = txwatch_hash_first(&topo->txwatches, &i); |
| 291 | w; |
| 292 | w = txwatch_hash_next(&topo->txwatches, &i)) { |
| 293 | u32 depth; |
| 294 | |
| 295 | depth = get_tx_depth(topo, &w->txid); |
| 296 | if (depth) { |
| 297 | if (!w->tx) |
| 298 | w->tx = wallet_transaction_get(w, topo->ld->wallet, |
| 299 | &w->txid); |
| 300 | needs_rerun |= txw_fire(w, &w->txid, depth); |
| 301 | } |
| 302 | } |
| 303 | } while (needs_rerun); |
| 304 | } |
| 305 | |
| 306 | void txwatch_inform(const struct chain_topology *topo, |
| 307 | const struct bitcoin_txid *txid, |
no test coverage detected