Skip to content

Commit

Permalink
add some trace log
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzhhuang committed Aug 31, 2024
1 parent 1d77248 commit a5a21d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
11 changes: 0 additions & 11 deletions sync/src/parallel/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ impl DagBlockSender {
|| block.header.parents_hash().contains(header_id)
{
executor.state = ExecuteState::Executing(block.id());
info!(
"send the block {:?} to the executor: {:p}",
block.id(),
&executor
);
match executor.sender_to_executor.try_send(block.clone()) {
Ok(_) => (),
Err(e) => match e {
Expand Down Expand Up @@ -134,11 +129,6 @@ impl DagBlockSender {
handle: executor.start_to_execute()?,
};

info!(
"send the block {:?} to the executor: {:p}",
block.id(),
&executor
);
sender_to_worker.send(block).await?;
self.executors.push(executor);

Expand Down Expand Up @@ -180,7 +170,6 @@ impl DagBlockSender {
true
}
});
info!("sync workers count: {:?}", self.executors.len());
anyhow::Ok(())
}

Expand Down
9 changes: 8 additions & 1 deletion sync/src/tasks/block_sync_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,24 +395,31 @@ where
block_header: BlockHeader,
absent_blocks: &mut Vec<HashValue>,
) -> Result<()> {
info!("check the parents{:?} exists", block_header.id());
let parents = block_header.parents_hash();
if parents.is_empty() {
return Ok(());
}
for parent in parents {
if self.chain.has_dag_block(parent)? {
info!("parent {:?} exists", parent);
continue;
}
match self.local_store.get_dag_sync_block(parent)? {
Some(block) => {
info!("parent {:?} in local, save in sync dag store", parent);
match self.sync_dag_store.get_dag_sync_block(block.block.header().number(), block.block.header().id()) {
Ok(_) => (),
Ok(_) => {
info!("parent {:?} already in local, save in sync dag store", parent);
}
Err(_) => {
info!("parent {:?} goes to be saved in local, save in sync dag store", parent);
self.sync_dag_store.save_block(block.block)?;
}
}
}
None => {
info!("parent {:?} not in local, fetch from remote", parent);
if absent_blocks.contains(&parent) {
continue;
}
Expand Down

0 comments on commit a5a21d7

Please sign in to comment.