Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit fad5d58

Browse files
authored
stake-pool: Refresh blockhash more on failing test (#3981)
1 parent f600c90 commit fad5d58

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

stake-pool/program/tests/withdraw_edge_cases.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,17 @@ async fn success_with_small_preferred_withdraw() {
725725
tokens_to_burn,
726726
) = setup_for_withdraw(spl_token::id()).await;
727727

728+
let last_blockhash = context
729+
.banks_client
730+
.get_new_latest_blockhash(&context.last_blockhash)
731+
.await
732+
.unwrap();
733+
728734
// make pool tokens very valuable, so it isn't possible to exactly get down to the minimum
729735
transfer(
730736
&mut context.banks_client,
731737
&context.payer,
732-
&context.last_blockhash,
738+
&last_blockhash,
733739
&stake_pool_accounts.reserve_stake.pubkey(),
734740
deposit_info.stake_lamports * 5, // each pool token is worth more than one lamport
735741
)
@@ -738,7 +744,7 @@ async fn success_with_small_preferred_withdraw() {
738744
.update_all(
739745
&mut context.banks_client,
740746
&context.payer,
741-
&context.last_blockhash,
747+
&last_blockhash,
742748
&[validator_stake.vote.pubkey()],
743749
false,
744750
)
@@ -747,7 +753,7 @@ async fn success_with_small_preferred_withdraw() {
747753
let preferred_validator = simple_add_validator_to_pool(
748754
&mut context.banks_client,
749755
&context.payer,
750-
&context.last_blockhash,
756+
&last_blockhash,
751757
&stake_pool_accounts,
752758
None,
753759
)
@@ -757,15 +763,15 @@ async fn success_with_small_preferred_withdraw() {
757763
.set_preferred_validator(
758764
&mut context.banks_client,
759765
&context.payer,
760-
&context.last_blockhash,
766+
&last_blockhash,
761767
instruction::PreferredValidatorType::Withdraw,
762768
Some(preferred_validator.vote.pubkey()),
763769
)
764770
.await;
765771

766772
let last_blockhash = context
767773
.banks_client
768-
.get_new_latest_blockhash(&context.last_blockhash)
774+
.get_new_latest_blockhash(&last_blockhash)
769775
.await
770776
.unwrap();
771777

0 commit comments

Comments
 (0)