File tree 2 files changed +174
-34
lines changed
2 files changed +174
-34
lines changed Original file line number Diff line number Diff line change @@ -201,9 +201,18 @@ pub mod staking {
201
201
VestingError :: InvalidVestingBalancePDA
202
202
) ;
203
203
204
- vesting_balance. stake_account_metadata = stake_account_metadata. key ( ) ;
205
- stake_account_metadata
206
- . update_recorded_vesting_balance ( vesting_balance. total_vesting_balance ) ;
204
+ if vesting_balance. stake_account_metadata == Pubkey :: default ( ) {
205
+ vesting_balance. stake_account_metadata = stake_account_metadata. key ( ) ;
206
+
207
+ let new_recorded_vesting_balance = stake_account_metadata
208
+ . recorded_vesting_balance
209
+ . checked_add ( vesting_balance. total_vesting_balance )
210
+ . ok_or ( VestingError :: Overflow ) ?;
211
+
212
+ // Update the recorded vesting balance
213
+ stake_account_metadata
214
+ . update_recorded_vesting_balance ( new_recorded_vesting_balance) ;
215
+ }
207
216
}
208
217
}
209
218
}
You can’t perform that action at this time.
0 commit comments