Skip to content

Commit

Permalink
chore: only consider block-bearing network results if in ibd mode or …
Browse files Browse the repository at this point in the history
…if there's download pressure
  • Loading branch information
jcnelson committed Oct 28, 2024
1 parent 28fb59b commit 61d701b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions stackslib/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1616,6 +1616,10 @@ impl NetworkResult {
|| self.has_stackerdb_chunks()
}

pub fn has_block_data_to_store(&self) -> bool {
self.has_blocks() || self.has_microblocks() || self.has_nakamoto_blocks()
}

pub fn consume_unsolicited(&mut self, unhandled_messages: PendingMessages) {
for ((_event_id, neighbor_key), messages) in unhandled_messages.into_iter() {
for message in messages.into_iter() {
Expand Down
3 changes: 2 additions & 1 deletion testnet/stacks-node/src/nakamoto_node/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ impl PeerThread {
have_update = true;
}

if network_result.has_data_to_store()
if ((ibd || download_backpressure) && network_result.has_block_data_to_store())
|| (!ibd && network_result.has_data_to_store())
|| self.last_burn_block_height != network_result.burn_height
|| have_update
{
Expand Down

0 comments on commit 61d701b

Please sign in to comment.