From adf15c4a08bbeae7b9cb065c41e8b371c95d8e78 Mon Sep 17 00:00:00 2001 From: Michael Mallan Date: Fri, 18 Oct 2024 15:15:45 +0100 Subject: [PATCH] gui: don't treat new wallets using bitcoind as syncing If the user has imported a descriptor and is using bitcoind as a local node, then they will need to perform a rescan in order to see past transactions. Treating the wallet as syncing in this case could mislead the user that a rescan is being performed. Therefore, it's better to keep the past behaviour here to avoid further confusion. --- gui/src/app/state/mod.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gui/src/app/state/mod.rs b/gui/src/app/state/mod.rs index d324fc8fa..cbbe1d339 100644 --- a/gui/src/app/state/mod.rs +++ b/gui/src/app/state/mod.rs @@ -75,10 +75,20 @@ fn wallet_is_syncing( last_poll: Option, blockheight: i32, ) -> bool { - if let Some(_node_type) = node_type { - // Once the first poll has completed, the wallet will be synced - // with the blockchain of the local node. - last_poll <= last_poll_at_startup + if let Some(node_type) = node_type { + if node_type == NodeType::Bitcoind && blockheight <= 0 { + // If blockheight <= 0, then this is a newly created wallet. + // If user imported descriptor and is using a local bitcoind, + // a rescan will need to be performed in order to see + // past transactions and so the syncing status could be + // misleading as it could suggest the rescan is being + // performed. + false + } else { + // Once the first poll has completed, the wallet will be synced + // with the blockchain of the local node. + last_poll <= last_poll_at_startup + } } else { // If no node type, treat as remote backend: // The wallet is always synced except before the first scan