Skip to content

Commit

Permalink
Fix CI Failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamaguchi committed Aug 5, 2024
1 parent b93fae3 commit b33c8c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions crates/chain/src/keychain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//!
//! [`SpkTxOutIndex`]: crate::SpkTxOutIndex
/// Indexer for TxOut
#[cfg(feature = "miniscript")]
pub mod txout_index;
use tapyrus::Amount;
Expand Down
22 changes: 15 additions & 7 deletions crates/wallet/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ pub enum CreateContractError {
/// Other error.
Error {
/// An error that caused this error.
e: anyhow::Error,
reason: String,
},
}

Expand All @@ -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)
}
}
}
}
Expand All @@ -496,7 +498,7 @@ pub enum UpdateContractError {
/// Other error.
Error {
/// An error that caused this error.
e: anyhow::Error,
reason: String,
},
}

Expand All @@ -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)
}
}
}
}
Expand Down Expand Up @@ -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, _) =
Expand All @@ -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(())
}
Expand All @@ -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 });
}
Expand Down

0 comments on commit b33c8c9

Please sign in to comment.