Add more context to fallible functions inside bitcoin::Wallet

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

View File

@ -74,12 +74,13 @@ impl Wallet {
}
pub async fn balance(&self) -> Result<Amount> {
let balance = self.inner.lock().await.get_balance()?;
let balance = self.inner.lock().await.get_balance().context("Failed to calculate Bitcoin balance")?;
Ok(Amount::from_sat(balance))
}
pub async fn new_address(&self) -> Result<Address> {
let address = self.inner.lock().await.get_new_address()?;
let address = self.inner.lock().await.get_new_address().context("Failed to get new Bitcoin address")?;
Ok(address)
}