From 9e300a6bac1f2bf8fbfcf8c18717b02f994137b1 Mon Sep 17 00:00:00 2001 From: Yamaguchi Date: Mon, 5 Aug 2024 14:22:55 +0900 Subject: [PATCH] Fix CI Failure --- crates/chain/src/keychain.rs | 2 ++ crates/wallet/src/wallet/mod.rs | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/crates/chain/src/keychain.rs b/crates/chain/src/keychain.rs index 55ac23af..a3b84854 100644 --- a/crates/chain/src/keychain.rs +++ b/crates/chain/src/keychain.rs @@ -10,6 +10,8 @@ //! //! [`SpkTxOutIndex`]: crate::SpkTxOutIndex + +/// Indexer for TxOut #[cfg(feature = "miniscript")] pub mod txout_index; use tapyrus::Amount; diff --git a/crates/wallet/src/wallet/mod.rs b/crates/wallet/src/wallet/mod.rs index 766dfbcd..bf853b73 100644 --- a/crates/wallet/src/wallet/mod.rs +++ b/crates/wallet/src/wallet/mod.rs @@ -467,7 +467,7 @@ pub enum CreateContractError { /// Other error. Error { /// An error that caused this error. - e: anyhow::Error, + reason: String, }, } @@ -477,7 +477,9 @@ impl fmt::Display for CreateContractError { CreateContractError::ContractAlreadyExist { contract_id } => { write!(f, "contract already exists (contract_id: {})", contract_id) } - CreateContractError::Error { e } => e.fmt(f), + CreateContractError::Error { reason } => { + write!(f, "can not create contract address (reason: {})", reason) + } } } } @@ -496,7 +498,7 @@ pub enum UpdateContractError { /// Other error. Error { /// An error that caused this error. - e: anyhow::Error, + reason: String, }, } @@ -506,7 +508,9 @@ impl fmt::Display for UpdateContractError { UpdateContractError::ContractNotFound { contract_id } => { write!(f, "contract does not found (contract_id: {})", contract_id) } - UpdateContractError::Error { e } => e.fmt(f), + UpdateContractError::Error { reason } => { + write!(f, "can not update contract address (reason: {})", reason) + } } } } @@ -2791,7 +2795,7 @@ impl Wallet { let p2c_public_key = self.pay_to_contract_key(&payment_base, contract) .map_err(|e| CreateContractError::Error { - e: anyhow::Error::new(e), + reason: e.to_string(), })?; let descriptor_str = format!("pkh({})", p2c_public_key); let (descriptor, _) = @@ -2801,7 +2805,9 @@ impl Wallet { self.contracts.insert(contract_id.clone(), new_contract); self.persist .stage_and_commit(changeset) - .map_err(|e| CreateContractError::Error { e })?; + .map_err(|e| CreateContractError::Error { + reason: e.to_string(), + })?; } Ok(()) } @@ -2828,7 +2834,9 @@ impl Wallet { self.contracts.insert(contract_id.clone(), new_contract); self.persist .stage_and_commit(changeset) - .map_err(|e| UpdateContractError::Error { e })?; + .map_err(|e| UpdateContractError::Error { + reason: e.to_string(), + })?; } else { return Err(UpdateContractError::ContractNotFound { contract_id }); }