Skip to content

Commit f5cad21

Browse files
committed
crc: rename variables, cleaner comment
1 parent c4e26be commit f5cad21

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

stacks-node/src/nakamoto_node/relayer.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -653,22 +653,19 @@ impl RelayerThread {
653653
let canonical_stacks_tip =
654654
StacksBlockId::new(&canonical_stacks_tip_ch, &canonical_stacks_tip_bh);
655655

656-
let commits_to_tip_tenure = match Self::sortition_commits_to_stacks_tip_tenure(
656+
let commits_to_tip_tenure = Self::sortition_commits_to_stacks_tip_tenure(
657657
&mut self.chainstate,
658658
&canonical_stacks_tip,
659659
&canonical_stacks_snapshot,
660660
&sn,
661-
) {
662-
Ok(b) => b,
663-
Err(e) => {
664-
warn!(
665-
"Relayer: Failed to determine if winning sortition commits to current tenure: {e:?}";
666-
"sortition_ch" => %sn.consensus_hash,
667-
"stacks_tip_ch" => %canonical_stacks_tip_ch
668-
);
669-
false
670-
}
671-
};
661+
).unwrap_or_else(|e| {
662+
warn!(
663+
"Relayer: Failed to determine if winning sortition commits to current tenure: {e:?}";
664+
"sortition_ch" => %sn.consensus_hash,
665+
"stacks_tip_ch" => %canonical_stacks_tip_ch
666+
);
667+
false
668+
});
672669

673670
if !commits_to_tip_tenure {
674671
let won_ongoing_tenure_sortition =

stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5495,11 +5495,11 @@ fn forked_tenure_is_ignored() {
54955495
.get_stacks_blocks_processed();
54965496
// We don't expect a block in this tenure, because the miner should instead be building off
54975497
// of a previous tenure
5498-
let block_in_tenure = get_last_block_in_current_tenure(&sortdb, &chainstate).is_none();
5498+
let no_block_in_tenure = get_last_block_in_current_tenure(&sortdb, &chainstate).is_none();
54995499
Ok(commits_count > commits_before
55005500
&& blocks_count > blocks_before
55015501
&& blocks_processed > blocks_processed_before
5502-
&& block_in_tenure)
5502+
&& no_block_in_tenure)
55035503
})
55045504
.unwrap_or_else(|_| {
55055505
let commits_count = commits_submitted.load(Ordering::SeqCst);
@@ -5508,20 +5508,20 @@ fn forked_tenure_is_ignored() {
55085508
.lock()
55095509
.expect("Mutex poisoned")
55105510
.get_stacks_blocks_processed();
5511-
let block_in_tenure = get_last_block_in_current_tenure(&sortdb, &chainstate).is_none();
5512-
error!("Tenure C failed to produce a block";
5511+
let no_block_in_tenure = get_last_block_in_current_tenure(&sortdb, &chainstate).is_none();
5512+
error!("Tenure C shouldn't have produced a block";
55135513
"commits_count" => commits_count,
55145514
"commits_before" => commits_before,
55155515
"blocks_count" => blocks_count,
55165516
"blocks_before" => blocks_before,
55175517
"blocks_processed" => blocks_processed,
55185518
"blocks_processed_before" => blocks_processed_before,
5519-
"block_in_tenure" => block_in_tenure,
5519+
"no_block_in_tenure" => no_block_in_tenure,
55205520
);
5521-
panic!("Tenure C failed to produce a block");
5521+
panic!("Tenure C shouldn't have produced a block");
55225522
});
55235523

5524-
info!("Tenure C produced a block!");
5524+
info!("Tenure C did not produce a block");
55255525

55265526
let block_tenure_c = get_last_block_in_current_tenure(&sortdb, &chainstate);
55275527
assert!(block_tenure_c.is_none());

0 commit comments

Comments
 (0)