Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sync/src/block/downloader/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use primitives::{H256, U256};
use super::super::message::RequestMessage;

const MAX_HEADER_REQUEST_LENGTH: u64 = 128;
const MAX_HEADER_QUEUE_LENGTH: usize = 1024;
const MAX_RETRY: usize = 3;
const MAX_WAIT: u64 = 15;

Expand Down Expand Up @@ -128,6 +129,9 @@ impl HeaderDownloader {
if !self.is_idle() {
return None
}
if self.queued.len() + self.downloaded.len() > MAX_HEADER_QUEUE_LENGTH {
return None
}

let pivot_number = self.pivot_header().number();

Expand Down