mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-04-12 06:03:08 +00:00
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
This commit is contained in:
parent
fb083ce91e
commit
9b76da88ab
@ -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 }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user