@@ -24,11 +24,17 @@ async fn success_withdraw_all_fee_tokens() {
24
24
tokens_to_withdraw,
25
25
) = setup_for_withdraw ( spl_token:: id ( ) ) . await ;
26
26
27
+ let last_blockhash = context
28
+ . banks_client
29
+ . get_new_latest_blockhash ( & context. last_blockhash )
30
+ . await
31
+ . unwrap ( ) ;
32
+
27
33
// move tokens to fee account
28
34
transfer_spl_tokens (
29
35
& mut context. banks_client ,
30
36
& context. payer ,
31
- & context . last_blockhash ,
37
+ & last_blockhash,
32
38
& stake_pool_accounts. token_program_id ,
33
39
& deposit_info. pool_account . pubkey ( ) ,
34
40
& stake_pool_accounts. pool_mint . pubkey ( ) ,
@@ -49,7 +55,7 @@ async fn success_withdraw_all_fee_tokens() {
49
55
delegate_tokens (
50
56
& mut context. banks_client ,
51
57
& context. payer ,
52
- & context . last_blockhash ,
58
+ & last_blockhash,
53
59
& stake_pool_accounts. token_program_id ,
54
60
& stake_pool_accounts. pool_fee_account . pubkey ( ) ,
55
61
& stake_pool_accounts. manager ,
@@ -63,7 +69,7 @@ async fn success_withdraw_all_fee_tokens() {
63
69
. withdraw_stake (
64
70
& mut context. banks_client ,
65
71
& context. payer ,
66
- & context . last_blockhash ,
72
+ & last_blockhash,
67
73
& user_stake_recipient. pubkey ( ) ,
68
74
& user_transfer_authority,
69
75
& stake_pool_accounts. pool_fee_account . pubkey ( ) ,
@@ -95,11 +101,17 @@ async fn success_empty_out_stake_with_fee() {
95
101
tokens_to_withdraw,
96
102
) = setup_for_withdraw ( spl_token:: id ( ) ) . await ;
97
103
104
+ let last_blockhash = context
105
+ . banks_client
106
+ . get_new_latest_blockhash ( & context. last_blockhash )
107
+ . await
108
+ . unwrap ( ) ;
109
+
98
110
// add another validator and deposit into it
99
111
let other_validator_stake_account = simple_add_validator_to_pool (
100
112
& mut context. banks_client ,
101
113
& context. payer ,
102
- & context . last_blockhash ,
114
+ & last_blockhash,
103
115
& stake_pool_accounts,
104
116
None ,
105
117
)
@@ -108,7 +120,7 @@ async fn success_empty_out_stake_with_fee() {
108
120
let other_deposit_info = simple_deposit_stake (
109
121
& mut context. banks_client ,
110
122
& context. payer ,
111
- & context . last_blockhash ,
123
+ & last_blockhash,
112
124
& stake_pool_accounts,
113
125
& other_validator_stake_account,
114
126
TEST_STAKE_AMOUNT ,
@@ -120,7 +132,7 @@ async fn success_empty_out_stake_with_fee() {
120
132
transfer_spl_tokens (
121
133
& mut context. banks_client ,
122
134
& context. payer ,
123
- & context . last_blockhash ,
135
+ & last_blockhash,
124
136
& stake_pool_accounts. token_program_id ,
125
137
& deposit_info. pool_account . pubkey ( ) ,
126
138
& stake_pool_accounts. pool_mint . pubkey ( ) ,
@@ -137,11 +149,17 @@ async fn success_empty_out_stake_with_fee() {
137
149
)
138
150
. await ;
139
151
152
+ let last_blockhash = context
153
+ . banks_client
154
+ . get_new_latest_blockhash ( & last_blockhash)
155
+ . await
156
+ . unwrap ( ) ;
157
+
140
158
let user_transfer_authority = Keypair :: new ( ) ;
141
159
delegate_tokens (
142
160
& mut context. banks_client ,
143
161
& context. payer ,
144
- & context . last_blockhash ,
162
+ & last_blockhash,
145
163
& stake_pool_accounts. token_program_id ,
146
164
& other_deposit_info. pool_account . pubkey ( ) ,
147
165
& other_deposit_info. authority ,
@@ -160,12 +178,9 @@ async fn success_empty_out_stake_with_fee() {
160
178
let stake_state =
161
179
deserialize :: < stake:: state:: StakeState > ( & validator_stake_account. data ) . unwrap ( ) ;
162
180
let meta = stake_state. meta ( ) . unwrap ( ) ;
163
- let stake_minimum_delegation = stake_get_minimum_delegation (
164
- & mut context. banks_client ,
165
- & context. payer ,
166
- & context. last_blockhash ,
167
- )
168
- . await ;
181
+ let stake_minimum_delegation =
182
+ stake_get_minimum_delegation ( & mut context. banks_client , & context. payer , & last_blockhash)
183
+ . await ;
169
184
let lamports_to_withdraw =
170
185
validator_stake_account. lamports - minimum_stake_lamports ( & meta, stake_minimum_delegation) ;
171
186
let stake_pool_account = get_account (
@@ -183,12 +198,17 @@ async fn success_empty_out_stake_with_fee() {
183
198
let pool_tokens_to_withdraw =
184
199
lamports_to_withdraw * inverse_fee. denominator / inverse_fee. numerator ;
185
200
201
+ let last_blockhash = context
202
+ . banks_client
203
+ . get_new_latest_blockhash ( & last_blockhash)
204
+ . await
205
+ . unwrap ( ) ;
186
206
let new_authority = Pubkey :: new_unique ( ) ;
187
207
let error = stake_pool_accounts
188
208
. withdraw_stake (
189
209
& mut context. banks_client ,
190
210
& context. payer ,
191
- & context . last_blockhash ,
211
+ & last_blockhash,
192
212
& user_stake_recipient. pubkey ( ) ,
193
213
& user_transfer_authority,
194
214
& other_deposit_info. pool_account . pubkey ( ) ,
0 commit comments