Skip to content

Commit 9970130

Browse files
committed
chore: address more PR feedback; revert can_continue_tenure() check in relayer which was causing some CI tests fail
1 parent dd80215 commit 9970130

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

testnet/stacks-node/src/nakamoto_node/relayer.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,29 @@ impl RelayerThread {
526526
"Relayer: did not win sortition {}, so stopping tenure",
527527
&sn.sortition
528528
);
529-
return Some(MinerDirective::StopTenure);
529+
530+
let mining_pkh_opt = self.get_mining_key_pkh();
531+
532+
match Self::can_continue_tenure(
533+
&self.sortdb,
534+
&mut self.chainstate,
535+
sn.consensus_hash,
536+
mining_pkh_opt,
537+
) {
538+
Ok(Some(_)) => {
539+
// we could continue the ongoing tenure
540+
debug!("Relayer: Did not win sortition, but am mining the ongoing tenure. Allowing the new miner some time to come online before trying to continue.");
541+
self.tenure_extend_timeout = Some(Instant::now());
542+
return Some(MinerDirective::StopTenure);
543+
}
544+
Ok(None) => {
545+
return Some(MinerDirective::StopTenure);
546+
}
547+
Err(e) => {
548+
warn!("Relayer: failed to check to see if we can continue tenure: {e:?}");
549+
return Some(MinerDirective::StopTenure);
550+
}
551+
}
530552
}
531553

532554
// no sortition happened.
@@ -1722,7 +1744,7 @@ impl RelayerThread {
17221744
}
17231745

17241746
/// Try to start up a tenure-extend.
1725-
/// Only do this if the miner won the last-ever sortition but the burn view has changed.
1747+
/// Only do this if the miner won the highest valid sortition but the burn view has changed.
17261748
/// In the future, the miner will also try to extend its tenure if a subsequent miner appears
17271749
/// to be offline.
17281750
fn try_continue_tenure(&mut self) {

0 commit comments

Comments
 (0)