electrum: check in db if rescan required

This commit is contained in:
Michael Mallan 2024-09-06 21:17:34 +01:00 committed by Antoine Poinsot
parent b9aaea1429
commit 32fa86d663
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
2 changed files with 4 additions and 2 deletions

View File

@ -55,12 +55,13 @@ impl Electrum {
pub fn new(
client: client::Client,
bdk_wallet: wallet::BdkWallet,
full_scan: bool,
) -> Result<Self, ElectrumError> {
Ok(Self {
client,
bdk_wallet,
sync_count: 0,
full_scan: false, // by default, only perform full scan if wallet's local chain has height 0
full_scan,
})
}

View File

@ -361,7 +361,8 @@ fn setup_electrum(
receive_index,
change_index,
);
let electrum = Electrum::new(client, bdk_wallet).map_err(StartupError::Electrum)?;
let full_scan = db_conn.rescan_timestamp().is_some();
let electrum = Electrum::new(client, bdk_wallet, full_scan).map_err(StartupError::Electrum)?;
electrum
.sanity_checks(&genesis_hash)
.map_err(StartupError::Electrum)?;