From 00e7148c38794016a0b01f6165ae81aa7a2ad4ea Mon Sep 17 00:00:00 2001 From: Samuel Onoja Date: Tue, 10 Dec 2024 23:53:41 +0100 Subject: [PATCH] minor changes to error --- mm2src/coins/z_coin.rs | 2 +- mm2src/coins/z_coin/storage.rs | 9 +++------ mm2src/coins/z_coin/z_htlc.rs | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/mm2src/coins/z_coin.rs b/mm2src/coins/z_coin.rs index 7e3b02ff64..8f52649a3d 100644 --- a/mm2src/coins/z_coin.rs +++ b/mm2src/coins/z_coin.rs @@ -480,7 +480,7 @@ impl ZCoin { // and saving them to the wallet database for future spends store_change_output(self.consensus_params_ref(), &self.z_fields.light_wallet_db, &tx) .await - .mm_err(GenTxError::SaveChangeNotesError)?; + .map_to_mm(GenTxError::SaveChangeNotesError)?; let additional_data = AdditionalTxData { received_by_me, diff --git a/mm2src/coins/z_coin/storage.rs b/mm2src/coins/z_coin/storage.rs index 5699a86ade..8c29f81f33 100644 --- a/mm2src/coins/z_coin/storage.rs +++ b/mm2src/coins/z_coin/storage.rs @@ -5,7 +5,6 @@ pub use blockdb::*; pub mod walletdb; #[cfg(target_arch = "wasm32")] mod z_params; -use mm2_err_handle::prelude::MapToMmResult; #[cfg(target_arch = "wasm32")] pub(crate) use z_params::ZcashParamsWasmImpl; @@ -202,11 +201,9 @@ pub(crate) async fn store_change_output( params: &ZcoinConsensusParams, shared_db: &WalletDbShared, tx: &Transaction, -) -> MmResult<(), String> { - let mut data = shared_db.db.get_update_ops().map_to_mm(|err| err.to_string())?; - decrypt_and_store_transaction(params, &mut data, tx) - .await - .map_to_mm(|err| err.to_string())?; +) -> Result<(), String> { + let mut data = try_s!(shared_db.db.get_update_ops()); + try_s!(decrypt_and_store_transaction(params, &mut data, tx).await); Ok(()) } diff --git a/mm2src/coins/z_coin/z_htlc.rs b/mm2src/coins/z_coin/z_htlc.rs index 50052424c3..bd32389f51 100644 --- a/mm2src/coins/z_coin/z_htlc.rs +++ b/mm2src/coins/z_coin/z_htlc.rs @@ -195,7 +195,7 @@ pub async fn z_p2sh_spend( // and saving them to the wallet database for future spends store_change_output(coin.consensus_params_ref(), &coin.z_fields.light_wallet_db, &zcash_tx) .await - .mm_err(|err| ZP2SHSpendError::GenTxError(GenTxError::SaveChangeNotesError(err)))?; + .map_to_mm(|err| ZP2SHSpendError::GenTxError(GenTxError::SaveChangeNotesError(err)))?; coin.utxo_rpc_client() .send_raw_transaction(tx_buffer.into())