Skip to content

Commit

Permalink
remove some commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzhhuang committed Sep 5, 2024
1 parent d1edfb7 commit 532d9b6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 66 deletions.
14 changes: 0 additions & 14 deletions sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,20 +618,6 @@ impl EventHandler<Self, NewHeadBlock> for SyncService {
}
}

// #[derive(Debug, Clone)]
// pub struct SaveSyncBlock {
// pub block: Block,
// }

// impl EventHandler<Self, SaveSyncBlock> for SyncService {
// fn handle_event(&mut self, msg: SaveSyncBlock, _ctx: &mut ServiceContext<Self>) {
// let block = msg.block;
// if let Err(e) = self.sync_dag_store.save_block(block) {
// error!("[sync] Save absent block error: {:?}", e);
// }
// }
// }

impl ServiceHandler<Self, SyncStatusRequest> for SyncService {
fn handle(&mut self, _msg: SyncStatusRequest, _ctx: &mut ServiceContext<Self>) -> SyncStatus {
self.sync_status.clone()
Expand Down
24 changes: 0 additions & 24 deletions sync/src/tasks/block_sync_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,30 +477,6 @@ where
self.sync_dag_store.save_block(block)?;
anyhow::Ok(ParallelSign::NeedMoreBlocks)
}

// let sync_dag_store = self.sync_dag_store.clone();
// let mut absent_block_iter = sync_dag_store
// .iter_at_first()
// .context("Failed to create iterator for sync_dag_store")?;
// loop {
// debug!("start to read local absent block and try to execute the dag if its parents are ready.");
// let mut local_absent_block = vec![];
// match self.read_local_absent_block(&mut absent_block_iter, &mut local_absent_block)
// {
// anyhow::Result::Ok(_) => {
// if local_absent_block.is_empty() {
// info!("absent block is empty, continue to sync");
// break;
// }
// self.execute_absent_block(&mut local_absent_block)
// .context("Failed to execute absent block")?;
// }
// Err(e) => {
// error!("failed to read local absent block, error: {:?}", e);
// return Err(e);
// }
// }
// }
};
async_std::task::block_on(fut)
}
Expand Down
28 changes: 0 additions & 28 deletions sync/src/tasks/inner_sync_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,34 +157,6 @@ where
self.sync_dag_store.clone(),
);

// let mut absent_block_iter = self.sync_dag_store.iter_at_first()?;
// loop {
// let mut local_absent_block = vec![];
// match block_collector
// .read_local_absent_block(&mut absent_block_iter, &mut local_absent_block)
// {
// anyhow::Result::Ok(_) => {
// if local_absent_block.is_empty() {
// info!("absent block is empty, continue to sync");
// break;
// }
// match block_collector.execute_absent_block(&mut local_absent_block) {
// anyhow::Result::Ok(_) => (),
// Err(e) => {
// error!("failed to execute absent block, error: {:?}, break from the continuing block execution", e);
// break;
// }
// }
// }
// Err(e) => {
// error!("failed to read local absent block, error: {:?}, break from the continuing block execution", e);
// break;
// }
// }
// }
// // clear the dag sync if fork happened
// self.sync_dag_store.delete_all_dag_sync_block()?;

Ok(TaskGenerator::new(
block_sync_task,
buffer_size,
Expand Down

0 comments on commit 532d9b6

Please sign in to comment.