Skip to content

Commit ddd3001

Browse files
authored
Merge pull request #5104 from stacks-network/fix/backoff-err-5092
fix: use permanent backoff when stacker set not found
2 parents 3d04553 + 53c5723 commit ddd3001

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

stacks-signer/src/client/stacks_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ impl StacksClient {
595595
backoff::Error::permanent(e.into())
596596
})?;
597597
if error_data.err_type == GetStackersErrors::NOT_AVAILABLE_ERR_TYPE {
598-
Err(backoff::Error::transient(ClientError::NoSortitionOnChain))
598+
Err(backoff::Error::permanent(ClientError::NoSortitionOnChain))
599599
} else {
600600
warn!("Got error response ({status}): {}", error_data.err_msg);
601601
Err(backoff::Error::permanent(ClientError::RequestFailure(

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -831,31 +831,31 @@ fn reloads_signer_set_in() {
831831
);
832832

833833
info!("Waiting for signer set calculation.");
834-
let mut reward_set_calculated = false;
835834
let short_timeout = Duration::from_secs(30);
836-
let now = std::time::Instant::now();
837835
// Make sure the signer set is calculated before continuing or signers may not
838836
// recognize that they are registered signers in the subsequent burn block event
839837
let reward_cycle = signer_test.get_current_reward_cycle() + 1;
840838
signer_test
841839
.running_nodes
842840
.btc_regtest_controller
843841
.build_next_block(1);
844-
while !reward_set_calculated {
845-
let reward_set = signer_test
842+
wait_for(short_timeout.as_secs(), || {
843+
let reward_set = match signer_test
846844
.stacks_client
847845
.get_reward_set_signers(reward_cycle)
848-
.expect("Failed to check if reward set is calculated");
849-
reward_set_calculated = reward_set.is_some();
850-
if reward_set_calculated {
851-
info!("Signer set: {:?}", reward_set.unwrap());
846+
{
847+
Ok(x) => x,
848+
Err(e) => {
849+
warn!("Failed to check if reward set is calculated yet: {e:?}. Will try again");
850+
return Ok(false);
851+
}
852+
};
853+
if let Some(ref set) = reward_set {
854+
info!("Signer set: {:?}", set);
852855
}
853-
std::thread::sleep(Duration::from_secs(1));
854-
assert!(
855-
now.elapsed() < short_timeout,
856-
"Timed out waiting for reward set calculation"
857-
);
858-
}
856+
Ok(reward_set.is_some())
857+
})
858+
.expect("Timed out waiting for reward set to be calculated");
859859
info!("Signer set calculated");
860860

861861
// Manually consume one more block to ensure signers refresh their state

0 commit comments

Comments
 (0)