From 06d598efc129e327c8bc527b9d0ad6165ede4afc Mon Sep 17 00:00:00 2001 From: darosior Date: Wed, 5 Feb 2020 10:27:03 +0100 Subject: [PATCH] lightningd: clean utxos after the topology is setup We need our Bitcoin backend to be ready to get infos about some utxos --- lightningd/lightningd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 3b2ac1520..2d0f56c98 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -839,10 +839,6 @@ int main(int argc, char *argv[]) else if (max_blockheight != UINT32_MAX) max_blockheight -= ld->config.rescan; - /*~ Tell the wallet to start figuring out what to do for any reserved - * unspent outputs we may have crashed with. */ - wallet_clean_utxos(ld->wallet, ld->topology->bitcoind); - /*~ That's all of the wallet db operations for now. */ db_commit_transaction(ld->wallet->db); @@ -851,10 +847,14 @@ int main(int argc, char *argv[]) setup_topology(ld->topology, ld->timers, min_blockheight, max_blockheight); + db_begin_transaction(ld->wallet->db); + /*~ Tell the wallet to start figuring out what to do for any reserved + * unspent outputs we may have crashed with. */ + wallet_clean_utxos(ld->wallet, ld->topology->bitcoind); + /*~ Pull peers, channels and HTLCs from db. Needs to happen after the * topology is initialized since some decisions rely on being able to * know the blockheight. */ - db_begin_transaction(ld->wallet->db); unconnected_htlcs_in = load_channels_from_wallet(ld); db_commit_transaction(ld->wallet->db);