From 9b76da88ab28cd10759f49249c40dcf81b7ae4d7 Mon Sep 17 00:00:00 2001 From: ygd58 Date: Thu, 26 Mar 2026 11:20:31 +0100 Subject: [PATCH] fix: reject transfer when --from and --to are the same account Previously, wallet submitted the transaction to the sequencer which rejected it with 'Duplicate account_ids found in message'. The user only saw 'Transaction not found in preconfigured amount of blocks' with no actionable feedback. Now wallet validates upfront and returns a clear error: 'Invalid transfer: --from and --to cannot be the same account' Fixes #264 --- wallet/src/cli/programs/native_token_transfer.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wallet/src/cli/programs/native_token_transfer.rs b/wallet/src/cli/programs/native_token_transfer.rs index b3f833ac..93a4a583 100644 --- a/wallet/src/cli/programs/native_token_transfer.rs +++ b/wallet/src/cli/programs/native_token_transfer.rs @@ -121,6 +121,13 @@ impl WalletSubcommand for AuthTransferSubcommand { let (from, from_privacy) = parse_addr_with_privacy_prefix(&from)?; let (to, to_privacy) = parse_addr_with_privacy_prefix(&to)?; + if from == to { + anyhow::bail!( + "Invalid transfer: --from and --to cannot be the same account ({})", + from + ); + } + match (from_privacy, to_privacy) { (AccountPrivacyKind::Public, AccountPrivacyKind::Public) => { NativeTokenTransferProgramSubcommand::Public { from, to, amount }