removeValidatorFromPool static method

TransactionInstruction removeValidatorFromPool({
  1. required Pubkey stakePoolAddress,
  2. required Pubkey staker,
  3. required Pubkey withdrawAuthority,
  4. required Pubkey validatorList,
  5. required Pubkey stakeAccount,
  6. required Pubkey transientStakeAccount,
})

(Staker only) Removes a validator from the pool, deactivating its stake.

Only succeeds if the validator stake account has the minimum of max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation()) plus the rent-exempt amount.

Keys:

  • stakePoolAddress [w] - Stake pool.
  • staker [s] Staker.
  • withdrawAuthority [] Stake pool withdraw authority.
  • validatorList [w] Validator stake list storage account.
  • stakeAccount [w] Stake account to remove from the pool.
  • transientStakeAccount [] Transient stake account, to check that that we're not trying to activate.

Implementation

static TransactionInstruction removeValidatorFromPool({
  required final Pubkey stakePoolAddress,
  required final Pubkey staker,
  required final Pubkey withdrawAuthority,
  required final Pubkey validatorList,
  required final Pubkey stakeAccount,
  required final Pubkey transientStakeAccount,
}) {
  // 0. `[w]` Stake pool
  // 1. `[s]` Staker
  // 2. `[]` Stake pool withdraw authority
  // 3. `[w]` Validator stake list storage account
  // 4. `[w]` Stake account to remove from the pool
  // 5. `[]` Transient stake account, to check that that we're not trying to activate
  // 6. `[]` Sysvar clock
  // 7. `[]` Stake program id
  final List<AccountMeta> keys = [
    AccountMeta.writable(stakePoolAddress),
    AccountMeta.signer(staker),
    AccountMeta(withdrawAuthority),
    AccountMeta.writable(validatorList),
    AccountMeta.writable(stakeAccount),
    AccountMeta(transientStakeAccount),
    AccountMeta(sysvarClockPubkey),
    AccountMeta(StakeProgram.programId),
  ];

  return _instance.createTransactionIntruction(
    StakePoolInstruction.removeValidatorFromPool,
    keys: keys,
  );
}