@@ -105,7 +105,11 @@ impl<'info> crate::contexts::TransferVesting<'info> {
105
105
}
106
106
107
107
if self . vesting_balance . stake_account_metadata != Pubkey :: default ( ) {
108
- if let ( Some ( stake_account_metadata) , Some ( delegate_stake_account_metadata) , Some ( delegate_stake_account_checkpoints) ) = (
108
+ if let (
109
+ Some ( stake_account_metadata) ,
110
+ Some ( delegate_stake_account_metadata) ,
111
+ Some ( delegate_stake_account_checkpoints) ,
112
+ ) = (
109
113
& mut self . stake_account_metadata ,
110
114
& mut self . delegate_stake_account_metadata ,
111
115
& mut self . delegate_stake_account_checkpoints ,
@@ -137,19 +141,21 @@ impl<'info> crate::contexts::TransferVesting<'info> {
137
141
VestingError :: InvalidStakeAccountOwner
138
142
) ;
139
143
140
- let ( expected_delegate_stake_account_checkpoints_pda, _) = Pubkey :: find_program_address (
141
- & [
142
- CHECKPOINT_DATA_SEED . as_bytes ( ) ,
143
- stake_account_metadata. delegate . key ( ) . as_ref ( ) ,
144
- delegate_stake_account_metadata
145
- . stake_account_checkpoints_last_index
146
- . to_le_bytes ( )
147
- . as_ref ( ) ,
148
- ] ,
149
- & crate :: ID ,
150
- ) ;
144
+ let ( expected_delegate_stake_account_checkpoints_pda, _) =
145
+ Pubkey :: find_program_address (
146
+ & [
147
+ CHECKPOINT_DATA_SEED . as_bytes ( ) ,
148
+ stake_account_metadata. delegate . key ( ) . as_ref ( ) ,
149
+ delegate_stake_account_metadata
150
+ . stake_account_checkpoints_last_index
151
+ . to_le_bytes ( )
152
+ . as_ref ( ) ,
153
+ ] ,
154
+ & crate :: ID ,
155
+ ) ;
151
156
require ! (
152
- expected_delegate_stake_account_checkpoints_pda == delegate_stake_account_checkpoints. key( ) ,
157
+ expected_delegate_stake_account_checkpoints_pda
158
+ == delegate_stake_account_checkpoints. key( ) ,
153
159
VestingError :: InvalidStakeAccountCheckpointsPDA
154
160
) ;
155
161
@@ -192,8 +198,7 @@ impl<'info> crate::contexts::TransferVesting<'info> {
192
198
if loaded_checkpoints. next_index
193
199
>= self . global_config . max_checkpoints_account_limit . into ( )
194
200
{
195
- if delegate_stake_account_metadata. key ( ) == stake_account_metadata. key ( )
196
- {
201
+ if delegate_stake_account_metadata. key ( ) == stake_account_metadata. key ( ) {
197
202
stake_account_metadata. stake_account_checkpoints_last_index += 1 ;
198
203
} else {
199
204
delegate_stake_account_metadata. stake_account_checkpoints_last_index += 1 ;
@@ -205,7 +210,11 @@ impl<'info> crate::contexts::TransferVesting<'info> {
205
210
}
206
211
207
212
if self . new_vesting_balance . stake_account_metadata != Pubkey :: default ( ) {
208
- if let ( Some ( new_stake_account_metadata) , Some ( new_delegate_stake_account_metadata) , Some ( new_delegate_stake_account_checkpoints) ) = (
213
+ if let (
214
+ Some ( new_stake_account_metadata) ,
215
+ Some ( new_delegate_stake_account_metadata) ,
216
+ Some ( new_delegate_stake_account_checkpoints) ,
217
+ ) = (
209
218
& mut self . new_stake_account_metadata ,
210
219
& mut self . new_delegate_stake_account_metadata ,
211
220
& mut self . new_delegate_stake_account_checkpoints ,
@@ -232,7 +241,8 @@ impl<'info> crate::contexts::TransferVesting<'info> {
232
241
233
242
// Verify that the actual new_delegate_stake_account_metadata address matches the expected one
234
243
require ! (
235
- new_stake_account_metadata. delegate == new_delegate_stake_account_metadata. owner,
244
+ new_stake_account_metadata. delegate
245
+ == new_delegate_stake_account_metadata. owner,
236
246
VestingError :: InvalidStakeAccountOwner
237
247
) ;
238
248
@@ -297,7 +307,8 @@ impl<'info> crate::contexts::TransferVesting<'info> {
297
307
{
298
308
new_stake_account_metadata. stake_account_checkpoints_last_index += 1 ;
299
309
} else {
300
- new_delegate_stake_account_metadata. stake_account_checkpoints_last_index += 1 ;
310
+ new_delegate_stake_account_metadata. stake_account_checkpoints_last_index +=
311
+ 1 ;
301
312
}
302
313
}
303
314
} else {
0 commit comments