From 583de6a721feae5ecfc612d8f9b4436ef8b6c8d7 Mon Sep 17 00:00:00 2001 From: Samuel Onoja <samiodev@icloud.com> Date: Tue, 10 Dec 2024 22:59:53 +0100 Subject: [PATCH] use better error naming for save change notes --- mm2src/coins/z_coin.rs | 2 +- mm2src/coins/z_coin/z_coin_errors.rs | 6 ++++-- mm2src/coins/z_coin/z_htlc.rs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mm2src/coins/z_coin.rs b/mm2src/coins/z_coin.rs index 6b539b0680..7e3b02ff64 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::Internal)?; + .mm_err(GenTxError::SaveChangeNotesError)?; let additional_data = AdditionalTxData { received_by_me, diff --git a/mm2src/coins/z_coin/z_coin_errors.rs b/mm2src/coins/z_coin/z_coin_errors.rs index 4e8fb2c3bf..ac4aa8d295 100644 --- a/mm2src/coins/z_coin/z_coin_errors.rs +++ b/mm2src/coins/z_coin/z_coin_errors.rs @@ -130,6 +130,7 @@ pub enum GenTxError { FailedToCreateNote, SpendableNotesError(String), Internal(String), + SaveChangeNotesError(String), } impl From<GetUnspentWitnessErr> for GenTxError { @@ -176,8 +177,9 @@ impl From<GenTxError> for WithdrawError { | GenTxError::BlockchainScanStopped | GenTxError::LightClientErr(_) | GenTxError::SpendableNotesError(_) - | GenTxError::FailedToCreateNote => WithdrawError::InternalError(gen_tx.to_string()), - GenTxError::Internal(_) => WithdrawError::InternalError(gen_tx.to_string()), + | GenTxError::FailedToCreateNote + | GenTxError::Internal(_) + | GenTxError::SaveChangeNotesError(_) => WithdrawError::InternalError(gen_tx.to_string()), } } } diff --git a/mm2src/coins/z_coin/z_htlc.rs b/mm2src/coins/z_coin/z_htlc.rs index dc9b8ba5fd..50052424c3 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::Internal(err)))?; + .mm_err(|err| ZP2SHSpendError::GenTxError(GenTxError::SaveChangeNotesError(err)))?; coin.utxo_rpc_client() .send_raw_transaction(tx_buffer.into())