Skip to content

Commit 6367b83

Browse files
authored
Merge pull request #5905 from fdefelici/fix/reduce-downloader-verbosity
Fix/reduce downloader verbosity
2 parents 3342dd8 + ace8fc3 commit 6367b83

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
1313
### Changed
1414

1515
- When a miner times out waiting for signatures, it will re-propose the same block instead of building a new block ([#5877](https://github.com/stacks-network/stacks-core/pull/5877))
16+
- Improve tenure downloader trace verbosity applying proper logging level depending on the tenure state ("debug" if unconfirmed, "info" otherwise) ([#5871](https://github.com/stacks-network/stacks-core/issues/5871))
1617

1718
## [3.1.0.0.7]
1819

stackslib/src/net/download/nakamoto/tenure_downloader.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ pub struct NakamotoTenureDownloader {
149149
pub tenure_end_block: Option<NakamotoBlock>,
150150
/// Tenure blocks
151151
pub tenure_blocks: Option<Vec<NakamotoBlock>>,
152+
/// Whether this tenure is unconfirmed
153+
pub is_tenure_unconfirmed: bool,
152154
}
153155

154156
impl NakamotoTenureDownloader {
@@ -161,6 +163,7 @@ impl NakamotoTenureDownloader {
161163
naddr: NeighborAddress,
162164
start_signer_keys: RewardSet,
163165
end_signer_keys: RewardSet,
166+
is_tenure_unconfirmed: bool,
164167
) -> Self {
165168
debug!(
166169
"Instantiate downloader to {}-{} for tenure {}: {}-{}",
@@ -187,6 +190,7 @@ impl NakamotoTenureDownloader {
187190
tenure_start_block: None,
188191
tenure_end_block: None,
189192
tenure_blocks: None,
193+
is_tenure_unconfirmed,
190194
}
191195
}
192196

stackslib/src/net/download/nakamoto/tenure_downloader_set.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ impl NakamotoTenureDownloaderSet {
520520
naddr.clone(),
521521
start_reward_set.clone(),
522522
end_reward_set.clone(),
523+
false,
523524
);
524525

525526
debug!("Request tenure {ch} from neighbor {naddr}");
@@ -671,14 +672,18 @@ impl NakamotoTenureDownloaderSet {
671672
);
672673
new_blocks.insert(downloader.tenure_id_consensus_hash.clone(), blocks);
673674
if downloader.is_done() {
674-
info!(
675-
"Downloader for tenure {} is finished",
676-
&downloader.tenure_id_consensus_hash
677-
);
678-
debug!(
679-
"Downloader for tenure {} finished on {naddr}",
680-
&downloader.tenure_id_consensus_hash,
681-
);
675+
if downloader.is_tenure_unconfirmed {
676+
debug!(
677+
"Downloader for tenure {} finished on {naddr}",
678+
&downloader.tenure_id_consensus_hash,
679+
);
680+
} else {
681+
info!(
682+
"Downloader for tenure {} is finished",
683+
&downloader.tenure_id_consensus_hash
684+
);
685+
}
686+
682687
finished.push(naddr.clone());
683688
finished_tenures.push(CompletedTenure::from(downloader));
684689
continue;

stackslib/src/net/download/nakamoto/tenure_downloader_unconfirmed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ impl NakamotoUnconfirmedTenureDownloader {
742742
self.naddr.clone(),
743743
confirmed_signer_keys.clone(),
744744
unconfirmed_signer_keys.clone(),
745+
true,
745746
);
746747

747748
Ok(ntd)

stackslib/src/net/tests/download/nakamoto.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ fn test_nakamoto_tenure_downloader() {
292292
naddr,
293293
reward_set.clone(),
294294
reward_set,
295+
false,
295296
);
296297

297298
// must be first block

0 commit comments

Comments
 (0)