File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,7 @@ pub fn resize_or_reallocate_account_raw<'a>(
66
66
) -> ProgramResult {
67
67
let rent = Rent :: get ( ) ?;
68
68
let new_minimum_balance = rent. minimum_balance ( new_size) ;
69
- let lamports_diff =
70
- new_minimum_balance. abs_diff ( target_account. lamports ( ) ) ;
69
+ let lamports_diff = new_minimum_balance. abs_diff ( target_account. lamports ( ) ) ;
71
70
if new_size == target_account. data_len ( ) {
72
71
return Ok ( ( ) ) ;
73
72
}
@@ -89,10 +88,13 @@ pub fn resize_or_reallocate_account_raw<'a>(
89
88
account_infos,
90
89
) ?;
91
90
} else {
92
- ( * * target_account. try_borrow_mut_lamports ( ) ?)
91
+ let target_account_lamports = target_account. lamports ( ) ;
92
+ ( * * target_account. try_borrow_mut_lamports ( ) ?) = target_account_lamports
93
93
. checked_sub ( lamports_diff)
94
94
. ok_or ( ProgramError :: InvalidRealloc ) ?;
95
- ( * * funding_account. try_borrow_mut_lamports ( ) ?)
95
+
96
+ let funding_account_lamports = funding_account. lamports ( ) ;
97
+ ( * * funding_account. try_borrow_mut_lamports ( ) ?) = funding_account_lamports
96
98
. checked_add ( lamports_diff)
97
99
. ok_or ( ProgramError :: InvalidRealloc ) ?;
98
100
}
You can’t perform that action at this time.
0 commit comments