From 6753675c310e2f13f7c9f5434dd90b119ede3607 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 7 Jul 2022 11:56:51 +0930 Subject: [PATCH] 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 --- lightningd/chaintopology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 65b5734c1..9b0d894d4 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -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);