From 419c345edee91854ff7d402c5796c4f34775816c Mon Sep 17 00:00:00 2001 From: jackzhhuang Date: Fri, 27 Dec 2024 18:18:07 +0800 Subject: [PATCH] add fet hcblock --- sync/src/sync.rs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/sync/src/sync.rs b/sync/src/sync.rs index 9bbf0a32d1..0ff271a6d8 100644 --- a/sync/src/sync.rs +++ b/sync/src/sync.rs @@ -682,15 +682,7 @@ impl ServiceHandler for SyncService { )); } let block = block_from_remote - .first() - .as_ref() - .expect("it should not be none, because the len = 1") - .as_ref() - .ok_or_else(|| { - format_err!("Get block by id failed, block id: {:?}", msg.block_id) - })? - .0 - .clone(); + .first().expect("should not be none").0.clone(); storage.save_dag_sync_block(DagSyncBlock { block: block.clone(), children: vec![], @@ -733,13 +725,9 @@ impl ServiceHandler for SyncService { block_id )); } - parents_in_remote - .first() - .and_then(|opt_block| opt_block.as_ref()) - .map(|block| next_round.push(block.0.clone())) - .ok_or_else(|| { - format_err!("Get block by id failed, block id: {:?}", block_id) - })?; + let block = parents_in_remote + .first().expect("should not be none").0.clone(); + next_round.push(block.clone()); storage.save_dag_sync_block(DagSyncBlock { block: next_round.last().expect("impossible to be none").clone(), children: vec![],