Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- [FIX][cli] `notes --send` now rejects a recipient address whose network doesn't match the client's configured network, instead of silently sending to it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog entries carry their related PR.


### Breaking Changes

* [BREAKING][type][rust] Added the `TransactionRequestError::SwapNoteWithZeroAsset` variant, so exhaustive matches on `TransactionRequestError` must handle it ([#2459](https://github.com/0xMiden/rust-sdk/pull/2459)).
Expand Down
9 changes: 8 additions & 1 deletion bin/miden-cli/src/commands/notes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,14 @@ async fn send<AUTH: Keystore + Sync>(
let note: Note = note_record
.try_into()
.map_err(|e| CliError::from(ClientError::NoteRecordConversionError(e)))?;
let (_netid, address) = Address::decode(address).map_err(|e| CliError::Input(e.to_string()))?;
let (address_network_id, address) =
Address::decode(address).map_err(|e| CliError::Input(e.to_string()))?;
let client_network_id = client.network_id().await?;
if address_network_id != client_network_id {
return Err(CliError::Input(format!(
"Address network `{address_network_id}` does not match configured network `{client_network_id}`",
)));
}

match block_hint {
Some(block_hint) => {
Expand Down
Loading