@@ -678,8 +678,9 @@ fn command_update(config: &Config, stake_pool_address: &Pubkey) -> CommandResult
678
678
} )
679
679
. collect ( ) ;
680
680
681
- let mut instructions : Vec < Instruction > = vec ! [ ] ;
681
+ println ! ( "Updating stake pool..." ) ;
682
682
683
+ let mut instructions: Vec < Instruction > = vec ! [ ] ;
683
684
for accounts_chunk in accounts_to_update. chunks ( MAX_ACCOUNTS_TO_UPDATE ) {
684
685
instructions. push ( spl_stake_pool:: instruction:: update_validator_list_balance (
685
686
& spl_stake_pool:: id ( ) ,
@@ -688,20 +689,22 @@ fn command_update(config: &Config, stake_pool_address: &Pubkey) -> CommandResult
688
689
) ?) ;
689
690
}
690
691
691
- println ! ( "Updating stake pool..." ) ;
692
692
instructions. push ( spl_stake_pool:: instruction:: update_stake_pool_balance (
693
693
& spl_stake_pool:: id ( ) ,
694
694
stake_pool_address,
695
695
& stake_pool. validator_list ,
696
696
) ?) ;
697
697
698
- let mut transaction =
699
- Transaction :: new_with_payer ( & instructions, Some ( & config. fee_payer . pubkey ( ) ) ) ;
698
+ // TODO: A faster solution would be to send all the `update_validator_list_balance` instructions concurrently
699
+ for instruction in instructions {
700
+ let mut transaction =
701
+ Transaction :: new_with_payer ( & [ instruction] , Some ( & config. fee_payer . pubkey ( ) ) ) ;
700
702
701
- let ( recent_blockhash, fee_calculator) = config. rpc_client . get_recent_blockhash ( ) ?;
702
- check_fee_payer_balance ( config, fee_calculator. calculate_fee ( & transaction. message ( ) ) ) ?;
703
- transaction. sign ( & [ config. fee_payer . as_ref ( ) ] , recent_blockhash) ;
704
- send_transaction ( & config, transaction) ?;
703
+ let ( recent_blockhash, fee_calculator) = config. rpc_client . get_recent_blockhash ( ) ?;
704
+ check_fee_payer_balance ( config, fee_calculator. calculate_fee ( & transaction. message ( ) ) ) ?;
705
+ transaction. sign ( & [ config. fee_payer . as_ref ( ) ] , recent_blockhash) ;
706
+ send_transaction ( & config, transaction) ?;
707
+ }
705
708
Ok ( ( ) )
706
709
}
707
710
0 commit comments