lightningd: fire watches on blocks before telling lightningd.

We noticed bogus behavior where (with 200 blocks added at once)
lightningd didn't see a DF channel open: this is because we told
lightningd about the new blocks (and it timed out channel) before
the watches for the transaction are fired.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-07-07 11:56:51 +09:30 committed by neil saitug
parent 36e5156832
commit 6753675c31
1 changed files with 3 additions and 3 deletions

View File

@ -619,12 +619,12 @@ void topology_add_sync_waiter_(const tal_t *ctx,
static void updates_complete(struct chain_topology *topo)
{
if (!bitcoin_blkid_eq(&topo->tip->blkid, &topo->prev_tip)) {
/* Tell lightningd about new block. */
notify_new_block(topo->bitcoind->ld, topo->tip->height);
/* Tell watch code to re-evaluate all txs. */
watch_topology_changed(topo);
/* Tell lightningd about new block. */
notify_new_block(topo->bitcoind->ld, topo->tip->height);
/* Maybe need to rebroadcast. */
rebroadcast_txs(topo, NULL);