@@ -582,11 +582,17 @@ async fn fail_withdraw_from_transient() {
582
582
tokens_to_withdraw,
583
583
) = setup_for_withdraw ( spl_token:: id ( ) ) . await ;
584
584
585
+ let last_blockhash = context
586
+ . banks_client
587
+ . get_new_latest_blockhash ( & context. last_blockhash )
588
+ . await
589
+ . unwrap ( ) ;
590
+
585
591
// add a preferred withdraw validator, keep it empty, to be sure that this works
586
592
let preferred_validator = simple_add_validator_to_pool (
587
593
& mut context. banks_client ,
588
594
& context. payer ,
589
- & context . last_blockhash ,
595
+ & last_blockhash,
590
596
& stake_pool_accounts,
591
597
None ,
592
598
)
@@ -596,12 +602,18 @@ async fn fail_withdraw_from_transient() {
596
602
. set_preferred_validator (
597
603
& mut context. banks_client ,
598
604
& context. payer ,
599
- & context . last_blockhash ,
605
+ & last_blockhash,
600
606
instruction:: PreferredValidatorType :: Withdraw ,
601
607
Some ( preferred_validator. vote . pubkey ( ) ) ,
602
608
)
603
609
. await ;
604
610
611
+ let last_blockhash = context
612
+ . banks_client
613
+ . get_new_latest_blockhash ( & last_blockhash)
614
+ . await
615
+ . unwrap ( ) ;
616
+
605
617
let rent = context. banks_client . get_rent ( ) . await . unwrap ( ) ;
606
618
let stake_rent = rent. minimum_balance ( std:: mem:: size_of :: < stake:: state:: StakeState > ( ) ) ;
607
619
@@ -610,7 +622,7 @@ async fn fail_withdraw_from_transient() {
610
622
. decrease_validator_stake (
611
623
& mut context. banks_client ,
612
624
& context. payer ,
613
- & context . last_blockhash ,
625
+ & last_blockhash,
614
626
& validator_stake_account. stake_account ,
615
627
& validator_stake_account. transient_stake_account ,
616
628
deposit_info. stake_lamports + stake_rent - 2 ,
@@ -625,7 +637,7 @@ async fn fail_withdraw_from_transient() {
625
637
. withdraw_stake (
626
638
& mut context. banks_client ,
627
639
& context. payer ,
628
- & context . last_blockhash ,
640
+ & last_blockhash,
629
641
& user_stake_recipient. pubkey ( ) ,
630
642
& user_transfer_authority,
631
643
& deposit_info. pool_account . pubkey ( ) ,
@@ -657,11 +669,17 @@ async fn success_withdraw_from_transient() {
657
669
tokens_to_withdraw,
658
670
) = setup_for_withdraw ( spl_token:: id ( ) ) . await ;
659
671
672
+ let last_blockhash = context
673
+ . banks_client
674
+ . get_new_latest_blockhash ( & context. last_blockhash )
675
+ . await
676
+ . unwrap ( ) ;
677
+
660
678
// add a preferred withdraw validator, keep it empty, to be sure that this works
661
679
let preferred_validator = simple_add_validator_to_pool (
662
680
& mut context. banks_client ,
663
681
& context. payer ,
664
- & context . last_blockhash ,
682
+ & last_blockhash,
665
683
& stake_pool_accounts,
666
684
None ,
667
685
)
@@ -680,12 +698,18 @@ async fn success_withdraw_from_transient() {
680
698
let rent = context. banks_client . get_rent ( ) . await . unwrap ( ) ;
681
699
let stake_rent = rent. minimum_balance ( std:: mem:: size_of :: < stake:: state:: StakeState > ( ) ) ;
682
700
701
+ let last_blockhash = context
702
+ . banks_client
703
+ . get_new_latest_blockhash ( & last_blockhash)
704
+ . await
705
+ . unwrap ( ) ;
706
+
683
707
// decrease all of stake
684
708
let error = stake_pool_accounts
685
709
. decrease_validator_stake (
686
710
& mut context. banks_client ,
687
711
& context. payer ,
688
- & context . last_blockhash ,
712
+ & last_blockhash,
689
713
& validator_stake_account. stake_account ,
690
714
& validator_stake_account. transient_stake_account ,
691
715
deposit_info. stake_lamports + stake_rent,
@@ -701,7 +725,7 @@ async fn success_withdraw_from_transient() {
701
725
. withdraw_stake (
702
726
& mut context. banks_client ,
703
727
& context. payer ,
704
- & context . last_blockhash ,
728
+ & last_blockhash,
705
729
& user_stake_recipient. pubkey ( ) ,
706
730
& user_transfer_authority,
707
731
& deposit_info. pool_account . pubkey ( ) ,
0 commit comments