From 81dbbf5596a741c13c54c6aebe79fb81efb34c43 Mon Sep 17 00:00:00 2001 From: jackzhhuang Date: Sat, 7 Dec 2024 00:13:29 +0800 Subject: [PATCH] add ghost if pruning occurs --- flexidag/src/blockdag.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flexidag/src/blockdag.rs b/flexidag/src/blockdag.rs index 8b5e2def2f..385e1179c5 100644 --- a/flexidag/src/blockdag.rs +++ b/flexidag/src/blockdag.rs @@ -564,8 +564,12 @@ impl BlockDAG { blue_blocks: &[BlockHeader], header: &BlockHeader, ) -> Result { - self.ghost_dag_manager() - .verify_and_ghostdata(blue_blocks, header) + if header.pruning_point() != HashValue::zero() { + self.ghost_dag_manager().ghostdag(&header.parents()) + } else { + self.ghost_dag_manager() + .verify_and_ghostdata(blue_blocks, header) + } } pub fn check_upgrade(&self, main: &BlockHeader, genesis_id: HashValue) -> anyhow::Result<()> { // set the state with key 0