Skip to content

Commit

Permalink
fix: wallet errors (#5045)
Browse files Browse the repository at this point in the history
Description
---
- Add proper error for `invalid network` for normal Tx
- increase the size of pubkey in contacts (the last two bytes were hidden)
- add error dialog to contacts

How Has This Been Tested?
---
Manually.
  • Loading branch information
Cifko authored Jan 10, 2023
1 parent 8efe209 commit 9b16ffb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ impl ContactsTab {
.highlight_style(Style::default().add_modifier(Modifier::BOLD).fg(Color::Magenta))
.heading_style(Style::default().fg(Color::Magenta))
.max_width(MAX_WIDTH)
.add_column(Some("Alias"), Some(25), column0_items)
.add_column(Some("Alias"), Some(23), column0_items)
.add_column(None, Some(1), Vec::new())
.add_column(Some("Tari Address"), Some(64), column1_items)
.add_column(Some("Tari Address"), Some(66), column1_items)
.add_column(None, Some(1), Vec::new())
.add_column(Some("Emoji ID"), Some(14), column2_items)
.add_column(None, Some(1), Vec::new())
Expand Down Expand Up @@ -287,6 +287,10 @@ impl<B: Backend> Component<B> for ContactsTab {
self.draw_edit_contact(f, area, app_state);
}

if let Some(msg) = self.error_message.clone() {
draw_dialog(f, area, "Error!".to_string(), msg, Color::Red, 120, 9);
}

match self.confirmation_dialog {
None => (),
Some(ConfirmationDialogType::DeleteContact) => {
Expand Down
6 changes: 6 additions & 0 deletions base_layer/wallet/src/transaction_service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,12 @@ where
) -> Result<(), TransactionServiceError> {
let tx_id = TxId::new_random();
if destination.network() != self.resources.wallet_identity.network {
let _result = reply_channel
.send(Err(TransactionServiceError::InvalidNetwork))
.map_err(|e| {
warn!(target: LOG_TARGET, "Failed to send service reply");
e
});
return Err(TransactionServiceError::InvalidNetwork);
}
let dest_pubkey = destination.public_key();
Expand Down

0 comments on commit 9b16ffb

Please sign in to comment.