@@ -430,7 +430,7 @@ fn command_vsa_add(
430
430
}
431
431
432
432
if !config. no_update {
433
- command_update ( config, stake_pool_address, false , false ) ?;
433
+ command_update ( config, stake_pool_address, false , false , false ) ?;
434
434
}
435
435
436
436
// iterate until a free account is found
@@ -488,7 +488,7 @@ fn command_vsa_remove(
488
488
vote_account : & Pubkey ,
489
489
) -> CommandResult {
490
490
if !config. no_update {
491
- command_update ( config, stake_pool_address, false , false ) ?;
491
+ command_update ( config, stake_pool_address, false , false , false ) ?;
492
492
}
493
493
494
494
let stake_pool = get_stake_pool ( & config. rpc_client , stake_pool_address) ?;
@@ -535,7 +535,7 @@ fn command_increase_validator_stake(
535
535
) -> CommandResult {
536
536
let lamports = native_token:: sol_to_lamports ( amount) ;
537
537
if !config. no_update {
538
- command_update ( config, stake_pool_address, false , false ) ?;
538
+ command_update ( config, stake_pool_address, false , false , false ) ?;
539
539
}
540
540
541
541
let stake_pool = get_stake_pool ( & config. rpc_client , stake_pool_address) ?;
@@ -574,7 +574,7 @@ fn command_decrease_validator_stake(
574
574
) -> CommandResult {
575
575
let lamports = native_token:: sol_to_lamports ( amount) ;
576
576
if !config. no_update {
577
- command_update ( config, stake_pool_address, false , false ) ?;
577
+ command_update ( config, stake_pool_address, false , false , false ) ?;
578
578
}
579
579
580
580
let stake_pool = get_stake_pool ( & config. rpc_client , stake_pool_address) ?;
@@ -671,7 +671,7 @@ fn command_deposit_stake(
671
671
referrer_token_account : & Option < Pubkey > ,
672
672
) -> CommandResult {
673
673
if !config. no_update {
674
- command_update ( config, stake_pool_address, false , false ) ?;
674
+ command_update ( config, stake_pool_address, false , false , false ) ?;
675
675
}
676
676
677
677
let stake_pool = get_stake_pool ( & config. rpc_client , stake_pool_address) ?;
@@ -802,7 +802,7 @@ fn command_deposit_all_stake(
802
802
referrer_token_account : & Option < Pubkey > ,
803
803
) -> CommandResult {
804
804
if !config. no_update {
805
- command_update ( config, stake_pool_address, false , false ) ?;
805
+ command_update ( config, stake_pool_address, false , false , false ) ?;
806
806
}
807
807
808
808
let stake_addresses = get_all_stake ( & config. rpc_client , stake_authority) ?;
@@ -945,7 +945,7 @@ fn command_deposit_sol(
945
945
amount : f64 ,
946
946
) -> CommandResult {
947
947
if !config. no_update {
948
- command_update ( config, stake_pool_address, false , false ) ?;
948
+ command_update ( config, stake_pool_address, false , false , false ) ?;
949
949
}
950
950
951
951
let amount = native_token:: sol_to_lamports ( amount) ;
@@ -1139,6 +1139,7 @@ fn command_update(
1139
1139
stake_pool_address : & Pubkey ,
1140
1140
force : bool ,
1141
1141
no_merge : bool ,
1142
+ stale_only : bool ,
1142
1143
) -> CommandResult {
1143
1144
if config. no_update {
1144
1145
println ! ( "Update requested, but --no-update flag specified, so doing nothing" ) ;
@@ -1158,14 +1159,24 @@ fn command_update(
1158
1159
1159
1160
let validator_list = get_validator_list ( & config. rpc_client , & stake_pool. validator_list ) ?;
1160
1161
1161
- let ( mut update_list_instructions, final_instructions) =
1162
+ let ( mut update_list_instructions, final_instructions) = if stale_only {
1163
+ spl_stake_pool:: instruction:: update_stale_stake_pool (
1164
+ & spl_stake_pool:: id ( ) ,
1165
+ & stake_pool,
1166
+ & validator_list,
1167
+ stake_pool_address,
1168
+ no_merge,
1169
+ epoch_info. epoch ,
1170
+ )
1171
+ } else {
1162
1172
spl_stake_pool:: instruction:: update_stake_pool (
1163
1173
& spl_stake_pool:: id ( ) ,
1164
1174
& stake_pool,
1165
1175
& validator_list,
1166
1176
stake_pool_address,
1167
1177
no_merge,
1168
- ) ;
1178
+ )
1179
+ } ;
1169
1180
1170
1181
let update_list_instructions_len = update_list_instructions. len ( ) ;
1171
1182
if update_list_instructions_len > 0 {
@@ -1360,7 +1371,7 @@ fn command_withdraw_stake(
1360
1371
pool_amount : f64 ,
1361
1372
) -> CommandResult {
1362
1373
if !config. no_update {
1363
- command_update ( config, stake_pool_address, false , false ) ?;
1374
+ command_update ( config, stake_pool_address, false , false , false ) ?;
1364
1375
}
1365
1376
1366
1377
let stake_pool = get_stake_pool ( & config. rpc_client , stake_pool_address) ?;
@@ -1631,7 +1642,7 @@ fn command_withdraw_sol(
1631
1642
pool_amount : f64 ,
1632
1643
) -> CommandResult {
1633
1644
if !config. no_update {
1634
- command_update ( config, stake_pool_address, false , false ) ?;
1645
+ command_update ( config, stake_pool_address, false , false , false ) ?;
1635
1646
}
1636
1647
1637
1648
let stake_pool = get_stake_pool ( & config. rpc_client , stake_pool_address) ?;
@@ -1748,7 +1759,7 @@ fn command_set_manager(
1748
1759
new_fee_receiver : & Option < Pubkey > ,
1749
1760
) -> CommandResult {
1750
1761
if !config. no_update {
1751
- command_update ( config, stake_pool_address, false , false ) ?;
1762
+ command_update ( config, stake_pool_address, false , false , false ) ?;
1752
1763
}
1753
1764
let stake_pool = get_stake_pool ( & config. rpc_client , stake_pool_address) ?;
1754
1765
@@ -1800,7 +1811,7 @@ fn command_set_staker(
1800
1811
new_staker : & Pubkey ,
1801
1812
) -> CommandResult {
1802
1813
if !config. no_update {
1803
- command_update ( config, stake_pool_address, false , false ) ?;
1814
+ command_update ( config, stake_pool_address, false , false , false ) ?;
1804
1815
}
1805
1816
let mut signers = vec ! [ config. fee_payer. as_ref( ) , config. manager. as_ref( ) ] ;
1806
1817
unique_signers ! ( signers) ;
@@ -1825,7 +1836,7 @@ fn command_set_funding_authority(
1825
1836
funding_type : FundingType ,
1826
1837
) -> CommandResult {
1827
1838
if !config. no_update {
1828
- command_update ( config, stake_pool_address, false , false ) ?;
1839
+ command_update ( config, stake_pool_address, false , false , false ) ?;
1829
1840
}
1830
1841
let mut signers = vec ! [ config. fee_payer. as_ref( ) , config. manager. as_ref( ) ] ;
1831
1842
unique_signers ! ( signers) ;
@@ -1850,7 +1861,7 @@ fn command_set_fee(
1850
1861
new_fee : FeeType ,
1851
1862
) -> CommandResult {
1852
1863
if !config. no_update {
1853
- command_update ( config, stake_pool_address, false , false ) ?;
1864
+ command_update ( config, stake_pool_address, false , false , false ) ?;
1854
1865
}
1855
1866
let mut signers = vec ! [ config. fee_payer. as_ref( ) , config. manager. as_ref( ) ] ;
1856
1867
unique_signers ! ( signers) ;
@@ -2418,14 +2429,20 @@ fn main() {
2418
2429
Arg :: with_name ( "force" )
2419
2430
. long ( "force" )
2420
2431
. takes_value ( false )
2421
- . help ( "Update all balances, even if it has already been performed this epoch." ) ,
2432
+ . help ( "Update balances, even if it has already been performed this epoch." ) ,
2422
2433
)
2423
2434
. arg (
2424
2435
Arg :: with_name ( "no_merge" )
2425
2436
. long ( "no-merge" )
2426
2437
. takes_value ( false )
2427
2438
. help ( "Do not automatically merge transient stakes. Useful if the stake pool is in an expected state, but the balances still need to be updated." ) ,
2428
2439
)
2440
+ . arg (
2441
+ Arg :: with_name ( "stale_only" )
2442
+ . long ( "stale-only" )
2443
+ . takes_value ( false )
2444
+ . help ( "If set, only updates validator list balances that have not been updated for this epoch. Otherwise, updates all validator balances on the validator list." ) ,
2445
+ )
2429
2446
)
2430
2447
. subcommand ( SubCommand :: with_name ( "withdraw-stake" )
2431
2448
. about ( "Withdraw active stake from the stake pool in exchange for pool tokens" )
@@ -2903,7 +2920,8 @@ fn main() {
2903
2920
let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
2904
2921
let no_merge = arg_matches. is_present ( "no_merge" ) ;
2905
2922
let force = arg_matches. is_present ( "force" ) ;
2906
- command_update ( & config, & stake_pool_address, force, no_merge)
2923
+ let stale_only = arg_matches. is_present ( "stale_only" ) ;
2924
+ command_update ( & config, & stake_pool_address, force, no_merge, stale_only)
2907
2925
}
2908
2926
( "withdraw-stake" , Some ( arg_matches) ) => {
2909
2927
let stake_pool_address = pubkey_of ( arg_matches, "pool" ) . unwrap ( ) ;
0 commit comments