Skip to content

Commit

Permalink
Bot: Ignore errors collecting activation info
Browse files Browse the repository at this point in the history
This is hopefully a temporary fix.
  • Loading branch information
alex-at-planetariummusic committed Jan 26, 2024
1 parent 15c4612 commit bf821a9
Showing 1 changed file with 43 additions and 44 deletions.
87 changes: 43 additions & 44 deletions bot/src/stake_pool_v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,52 +527,51 @@ fn create_validator_stake_accounts(

if stake_account.is_some() {
// Check if the stake account is busy
let stake_activation =
client
.get_stake_activation(stake_address, None)
.map_err(|err| {
format!(
"Unable to get activation information for stake account: {}: {}",
stake_address, err
)
})?;

match stake_activation.state {
StakeActivationState::Activating => {
let action = format!(
"stake account busy due to stake activation of {}",
stake_address
);
warn!("Busy validator {}: {}", *identity, action);
validator_stake_actions.insert(*identity, action);
}
StakeActivationState::Deactivating => {
let action = format!(
"stake account busy due to stake deactivation of {}",
stake_address
);
warn!("Busy validator {}: {}", *identity, action);
validator_stake_actions.insert(*identity, action);
}
StakeActivationState::Active => {}
StakeActivationState::Inactive => {
let action =
format!("stake account busy due to inactive stake {}", stake_address);
warn!("Busy validator {}: {}", *identity, action);
match client.get_stake_activation(stake_address, None) {
Ok(stake_activation) => match stake_activation.state {
StakeActivationState::Activating => {
let action = format!(
"stake account busy due to stake activation of {}",
stake_address
);
warn!("Busy validator {}: {}", *identity, action);
validator_stake_actions.insert(*identity, action);
}
StakeActivationState::Deactivating => {
let action = format!(
"stake account busy due to stake deactivation of {}",
stake_address
);
warn!("Busy validator {}: {}", *identity, action);
validator_stake_actions.insert(*identity, action);
}
StakeActivationState::Active => {}
StakeActivationState::Inactive => {
let action =
format!("stake account busy due to inactive stake {}", stake_address);
warn!("Busy validator {}: {}", *identity, action);

transactions.push(Transaction::new_with_payer(
&[stake_instruction::delegate_stake(
&stake_address,
&authorized_staker.pubkey(),
vote_address,
)],
Some(&authorized_staker.pubkey()),
));
debug!(
"Activating stake account for validator {} ({})",
identity, stake_address
transactions.push(Transaction::new_with_payer(
&[stake_instruction::delegate_stake(
&stake_address,
&authorized_staker.pubkey(),
vote_address,
)],
Some(&authorized_staker.pubkey()),
));
debug!(
"Activating stake account for validator {} ({})",
identity, stake_address
);
validator_stake_actions.insert(*identity, action);
}
},
Err(err) => {
// Just ignore these errors
warn!(
"Unable to get activation information for stake account: {}: {}",
stake_address, err
);
validator_stake_actions.insert(*identity, action);
}
}
} else {
Expand Down

0 comments on commit bf821a9

Please sign in to comment.