Skip to content

Commit

Permalink
use better error naming for save change notes
Browse files Browse the repository at this point in the history
  • Loading branch information
borngraced committed Dec 10, 2024
1 parent 3787b93 commit 583de6a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mm2src/coins/z_coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions mm2src/coins/z_coin/z_coin_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pub enum GenTxError {
FailedToCreateNote,
SpendableNotesError(String),
Internal(String),
SaveChangeNotesError(String),
}

impl From<GetUnspentWitnessErr> for GenTxError {
Expand Down Expand Up @@ -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()),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mm2src/coins/z_coin/z_htlc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 583de6a

Please sign in to comment.