-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add parallel sync buffer as 1000 and will star to execute the block i… #4216
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -421,13 +421,15 @@ where | |
Ok(()) | ||
} | ||
|
||
async fn find_absent_ancestor(&self, mut block_headers: Vec<BlockHeader>) -> Result<()> { | ||
async fn find_absent_ancestor(&self, mut block_headers: Vec<BlockHeader>) -> Result<u64> { | ||
let mut count: u64 = 0; | ||
loop { | ||
let mut absent_blocks = vec![]; | ||
self.find_absent_parent_dag_blocks_for_blocks(block_headers, &mut absent_blocks)?; | ||
if absent_blocks.is_empty() { | ||
return Ok(()); | ||
return Ok(count); | ||
} | ||
count = count.saturating_add(absent_blocks.len() as u64); | ||
block_headers = self.fetch_blocks(absent_blocks).await?; | ||
} | ||
} | ||
|
@@ -449,10 +451,15 @@ where | |
block_header.parents_hash() | ||
); | ||
let fut = async { | ||
self.find_absent_ancestor(vec![block_header.clone()]) | ||
let count = self | ||
.find_absent_ancestor(vec![block_header.clone()]) | ||
.await?; | ||
|
||
if block_header.number() % 10000 == 0 | ||
if count == 0 { | ||
return anyhow::Ok(ParallelSign::Continue); | ||
} | ||
|
||
if block_header.number() % 1000 == 0 | ||
Comment on lines
+454
to
+462
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assess the impact of changing the modulus condition from The condition has changed from checking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: 这个可以改成一个常量参数 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||
|| block_header.number() >= self.target.target_id.number() | ||
{ | ||
let parallel_execute = DagBlockSender::new( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure correct handling of the new return type of
find_absent_ancestor
The method
find_absent_ancestor
now returnsResult<u64>
instead ofResult<()>
. Within this file, ensure that all calls to this method correctly handle the new return value, and that thecount
of absent blocks is appropriately utilized.