Improve error message if stuff fails directly in main

This commit is contained in:
Thomas Eizinger 2021-03-04 17:16:18 +11:00
parent 37f97ac471
commit 5c24a46298
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

View File

@ -72,10 +72,10 @@ async fn main() -> Result<()> {
};
let db = Database::open(config.data.dir.join("database").as_path())
.context("Could not open database")?;
.context("Failed to open database")?;
let seed =
Seed::from_file_or_generate(&config.data.dir).expect("Could not retrieve/initialize seed");
Seed::from_file_or_generate(&config.data.dir).context("Failed to read in seed file")?;
// hardcode to testnet/stagenet
let bitcoin_network = bitcoin::Network::Testnet;
@ -254,7 +254,8 @@ async fn init_bitcoin_wallet(
&wallet_dir,
seed.derive_extended_private_key(network)?,
)
.await?;
.await
.context("Failed to initialize Bitcoin wallet")?;
wallet.sync().await?;