Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,9 +1739,17 @@ fn setup_head(
let head = batch.get_block_header(&head.last_block_h)?;
let pibd_tip = store.pibd_head()?;
let pibd_head = batch.get_block_header(&pibd_tip.last_block_h)?;
let pibd_mmr_in_progress = !resetting_pibd
&& pibd_head.height >= head.height
&& (txhashset.output_mmr_size() > head.output_mmr_size
|| txhashset.rangeproof_mmr_size() > head.output_mmr_size
|| txhashset.kernel_mmr_size() > head.kernel_mmr_size);
if pibd_head.height > head.height && !resetting_pibd {
pibd_in_progress = true;
pibd_head
} else if pibd_mmr_in_progress {
pibd_in_progress = true;
head
} else {
head
}
Expand Down
15 changes: 9 additions & 6 deletions chain/src/pibd_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,26 @@ pub const RANGEPROOF_SEGMENT_HEIGHT: u8 = 11;
/// Kernel segment height assumed for requests and segment calculation
pub const KERNEL_SEGMENT_HEIGHT: u8 = 11;

/// Maximum number of received segments to cache (across all trees) before we stop requesting others
pub const MAX_CACHED_SEGMENTS: usize = 15;
/// Maximum cached segment threshold used when dropping stale segment cache entries.
pub const MAX_CACHED_SEGMENTS: usize = 30;

/// Number of segments to apply in a single LMDB transaction
pub const SEGMENT_APPLY_BATCH_SIZE: usize = 4;
pub const SEGMENT_APPLY_BATCH_SIZE: usize = 12;

/// How long the state sync should wait after requesting a segment from a peer before
/// deciding the segment isn't going to arrive. The syncer will then re-request the segment
pub const SEGMENT_REQUEST_TIMEOUT_SECS: i64 = 20;
pub const SEGMENT_REQUEST_TIMEOUT_SECS: i64 = 30;

/// How long a peer is excluded from retrying a PIBD segment after serving invalid data.
pub const REJECTED_SEGMENT_RETRY_SECS: i64 = 600;

/// Number of simultaneous requests for segments we should make. Note this is currently
/// divisible by 3 to try and evenly spread requests amount the 3 main MMRs (Bitmap segments
/// will always be requested first)
pub const SEGMENT_REQUEST_COUNT: usize = 15;
pub const SEGMENT_REQUEST_COUNT: usize = 9;

/// How many blocks behind the tip a PIBD peer may be and still be considered usable.
pub const PIBD_PEER_HEIGHT_SLACK_BLOCKS: u64 = 2;
pub const SYNC_PEER_HEIGHT_SLACK_BLOCKS: u64 = 2;

/// If the syncer hasn't seen a max work peer that supports PIBD in this number of seconds
/// give up and revert back to the txhashset.zip download method
Expand Down
Loading
Loading