-
Notifications
You must be signed in to change notification settings - Fork 896
Cli stake-split: adjust transfer amount if recipient has lamports #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0e1f123
6d9d850
31f642a
230bc00
33cedb9
7c4929f
ca9a997
8f808c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1981,22 +1981,22 @@ pub fn process_split_stake( | |
|
|
||
| let rent_exempt_reserve = if !sign_only { | ||
| let check_stake_account = |account: Account| -> Result<(), CliError> { | ||
| if account.owner == stake::program::id() { | ||
| Err(CliError::BadParameter(format!( | ||
| match account.owner { | ||
| owner if owner == stake::program::id() => Err(CliError::BadParameter(format!( | ||
| "Stake account {split_stake_account_address} already exists" | ||
| ))) | ||
| } else if account.owner == system_program::id() { | ||
| if !account.data.is_empty() { | ||
| Err(CliError::BadParameter(format!( | ||
| "Account {split_stake_account_address} has data and cannot be used to split stake" | ||
| ))) | ||
| } else { | ||
| // if `stake_account`'s owner is the system_program and its data is | ||
| // empty, `stake_account` is allowed to receive the stake split | ||
| Ok(()) | ||
| ))), | ||
| owner if owner == system_program::id() => { | ||
| if !account.data.is_empty() { | ||
| Err(CliError::BadParameter(format!( | ||
| "Account {split_stake_account_address} has data and cannot be used to split stake" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i wonder if we should spruce up these error messages to be a little more normie-friendly? maybe in follow up
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I'll make a follow-up. If you have recommended verbiage, please do share. |
||
| ))) | ||
| } else { | ||
| // if `stake_account`'s owner is the system_program and its data is | ||
| // empty, `stake_account` is allowed to receive the stake split | ||
| Ok(()) | ||
| } | ||
| } | ||
| } else { | ||
| Err(CliError::BadParameter(format!( | ||
| _ => Err(CliError::BadParameter(format!( | ||
| "Account {split_stake_account_address} already exists and cannot be used to split stake" | ||
| ))) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.