Browse Source

exchanged code containing goto with a do while loop (#1758)

exchanged code containing goto with a do while loop
ppa-0.6.1
Rene Pickhardt 7 years ago
committed by Christian Decker
parent
commit
88ef2246e8
  1. 28
      lightningd/watch.c

28
lightningd/watch.c

@ -270,19 +270,17 @@ void watch_topology_changed(struct chain_topology *topo)
struct txwatch_hash_iter i; struct txwatch_hash_iter i;
struct txwatch *w; struct txwatch *w;
bool needs_rerun; bool needs_rerun;
do {
again: /* Iterating a htable during deletes is safe, but might skip entries. */
/* Iterating a htable during deletes is safe, but might skip entries. */ needs_rerun = false;
needs_rerun = false; for (w = txwatch_hash_first(&topo->txwatches, &i);
for (w = txwatch_hash_first(&topo->txwatches, &i); w;
w; w = txwatch_hash_next(&topo->txwatches, &i)) {
w = txwatch_hash_next(&topo->txwatches, &i)) { u32 depth;
u32 depth;
depth = get_tx_depth(topo, &w->txid);
depth = get_tx_depth(topo, &w->txid); if (depth)
if (depth) needs_rerun |= txw_fire(w, &w->txid, depth);
needs_rerun |= txw_fire(w, &w->txid, depth); }
} } while (needs_rerun);
if (needs_rerun)
goto again;
} }

Loading…
Cancel
Save