Update Initialized split rent-exempt value (#13646)
This commit is contained in:
parent
a7bed62af0
commit
39932d7664
|
@ -964,7 +964,9 @@ impl<'a> StakeAccount for KeyedAccount<'a> {
|
|||
return Err(InstructionError::InsufficientFunds);
|
||||
}
|
||||
|
||||
split.set_state(&StakeState::Initialized(meta))?;
|
||||
let mut split_meta = meta;
|
||||
split_meta.rent_exempt_reserve = split_rent_exempt_reserve;
|
||||
split.set_state(&StakeState::Initialized(split_meta))?;
|
||||
}
|
||||
StakeState::Uninitialized => {
|
||||
if !signers.contains(&self.unsigned_key()) {
|
||||
|
@ -4238,12 +4240,6 @@ mod tests {
|
|||
stake_lamports
|
||||
);
|
||||
|
||||
match state {
|
||||
StakeState::Initialized(_) => {
|
||||
assert_eq!(Ok(*state), split_stake_keyed_account.state());
|
||||
assert_eq!(Ok(*state), stake_keyed_account.state());
|
||||
}
|
||||
StakeState::Stake(meta, stake) => {
|
||||
let expected_rent_exempt_reserve = calculate_split_rent_exempt_reserve(
|
||||
meta.rent_exempt_reserve,
|
||||
std::mem::size_of::<StakeState>() as u64 + 100,
|
||||
|
@ -4254,6 +4250,16 @@ mod tests {
|
|||
rent_exempt_reserve: expected_rent_exempt_reserve,
|
||||
..Meta::default()
|
||||
};
|
||||
|
||||
match state {
|
||||
StakeState::Initialized(_) => {
|
||||
assert_eq!(
|
||||
Ok(StakeState::Initialized(expected_split_meta)),
|
||||
split_stake_keyed_account.state()
|
||||
);
|
||||
assert_eq!(Ok(*state), stake_keyed_account.state());
|
||||
}
|
||||
StakeState::Stake(meta, stake) => {
|
||||
let expected_stake = stake_lamports - expected_rent_exempt_reserve;
|
||||
|
||||
assert_eq!(
|
||||
|
|
Loading…
Reference in New Issue