diff --git a/src/bitcoin/d/mod.rs b/src/bitcoin/d/mod.rs index 6679edd8..ad4fd082 100644 --- a/src/bitcoin/d/mod.rs +++ b/src/bitcoin/d/mod.rs @@ -564,10 +564,9 @@ impl BitcoinD { Ok(()) } - /// Perform various sanity checks on the bitcoind instance. - pub fn sanity_check( + /// Perform various non-wallet-related sanity checks on the bitcoind instance. + pub fn node_sanity_checks( &self, - main_descriptor: &MultipathDescriptor, config_network: bitcoin::Network, ) -> Result<(), BitcoindError> { // Check the minimum supported bitcoind version @@ -591,6 +590,14 @@ impl BitcoinD { )); } + Ok(()) + } + + /// Perform various sanity checks of our watchonly wallet. + pub fn wallet_sanity_checks( + &self, + main_descriptor: &MultipathDescriptor, + ) -> Result<(), BitcoindError> { // Check our watchonly wallet is loaded if self .list_wallets() diff --git a/src/lib.rs b/src/lib.rs index 78d0d940..a9cf8bb5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -206,12 +206,13 @@ fn setup_bitcoind( .ok_or(StartupError::MissingBitcoindConfig)?, wo_path.to_str().expect("Must be valid unicode").to_string(), )?; + bitcoind.node_sanity_checks(config.bitcoin_config.network)?; if fresh_data_dir { bitcoind.create_watchonly_wallet(&config.main_descriptor)?; log::info!("Created a new watchonly wallet on bitcoind."); } bitcoind.maybe_load_watchonly_wallet()?; - bitcoind.sanity_check(&config.main_descriptor, config.bitcoin_config.network)?; + bitcoind.wallet_sanity_checks(&config.main_descriptor)?; log::info!("Connection to bitcoind established and checked."); Ok(bitcoind) @@ -635,10 +636,10 @@ mod tests { } }); complete_sanity_check(&server); - complete_wallet_creation(&server); - complete_wallet_loading(&server); complete_version_check(&server); complete_network_check(&server); + complete_wallet_creation(&server); + complete_wallet_loading(&server); complete_wallet_check(&server, &wo_path); complete_desc_check(&server, &receive_desc.to_string(), &change_desc.to_string()); complete_tip_init(&server); @@ -651,9 +652,9 @@ mod tests { handle.shutdown(); }); complete_sanity_check(&server); - complete_wallet_loading(&server); complete_version_check(&server); complete_network_check(&server); + complete_wallet_loading(&server); complete_wallet_check(&server, &wo_path); complete_desc_check(&server, &receive_desc.to_string(), &change_desc.to_string()); complete_sync_check(&server);