diff --git a/daemon/chaintopology.c b/daemon/chaintopology.c index d8a34217c..b3529ae77 100644 --- a/daemon/chaintopology.c +++ b/daemon/chaintopology.c @@ -137,6 +137,7 @@ static void connect_blocks(struct lightningd_state *dstate, struct block *b) struct bitcoin_tx *tx = b->full_txs[i]; struct txwatch *w; struct sha256_double txid; + struct txwatch_hash_iter iter; size_t j; /* Tell them if it spends a txo we care about. */ @@ -153,8 +154,9 @@ static void connect_blocks(struct lightningd_state *dstate, struct block *b) /* We do spends first, in case that tells us to watch tx. */ bitcoin_txid(tx, &txid); - w = txwatch_hash_get(&dstate->txwatches, &txid); - if (w) { + for (w = txwatch_hash_getfirst(&dstate->txwatches, &txid, &iter); + w; + w = txwatch_hash_getnext(&dstate->txwatches, &txid, &iter)){ add_tx_to_block(b, w); /* Fire if it's the first we've seen it: this might * set up txo watches, which could fire in this block */ diff --git a/daemon/watch.c b/daemon/watch.c index 71b265190..bcb696e12 100644 --- a/daemon/watch.c +++ b/daemon/watch.c @@ -90,8 +90,6 @@ struct txwatch *watch_txid_(const tal_t *ctx, { struct txwatch *w; - assert(!txwatch_hash_get(&peer->dstate->txwatches, txid)); - w = tal(ctx, struct txwatch); w->depth = -1; w->txid = *txid;