From 2b726522d39673815963d709f7f59cceac78a192 Mon Sep 17 00:00:00 2001 From: jackzhhuang Date: Sat, 14 Sep 2024 17:00:23 +0800 Subject: [PATCH] fix the absent block saving process --- sync/src/tasks/block_sync_task.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sync/src/tasks/block_sync_task.rs b/sync/src/tasks/block_sync_task.rs index b143d39318..417a9bc442 100644 --- a/sync/src/tasks/block_sync_task.rs +++ b/sync/src/tasks/block_sync_task.rs @@ -399,14 +399,22 @@ where return Ok(()); } for parent in parents { - if self.local_store.get_dag_sync_block(parent)?.is_none() { - if absent_blocks.contains(&parent) { - continue; + match self.local_store.get_dag_sync_block(parent)? { + Some(block) => { + if self.chain.has_dag_block(parent)? { + continue; + } + self.sync_dag_store.save_block(block.block)?; } - if self.chain.has_dag_block(parent)? { - continue; + None => { + if absent_blocks.contains(&parent) { + continue; + } + if self.chain.has_dag_block(parent)? { + continue; + } + absent_blocks.push(parent) } - absent_blocks.push(parent) } } Ok(())