Skip to content

Commit

Permalink
revert the mergeset code
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzhhuang committed Nov 29, 2024
1 parent 018e02d commit 799f99d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
10 changes: 3 additions & 7 deletions flexidag/src/blockdag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,9 @@ impl BlockDAG {
);
let reachability_store = self.storage.reachability_store.clone();

let mut merge_set = self
.ghost_dag_manager()
.unordered_mergeset_without_selected_parent(
ghostdata.selected_parent,
&header.parents(),
)
.into_iter();
let mut merge_set = ghostdata
.unordered_mergeset_without_selected_parent()
.filter(|hash| self.storage.reachability_store.read().has(*hash).unwrap());
let add_block_result = {
let mut reachability_writer = reachability_store.write();
inquirer::add_block(
Expand Down
13 changes: 1 addition & 12 deletions flexidag/src/ghostdag/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::util::Refs;
use crate::consensusdb::schemadb::{GhostdagStoreReader, HeaderStoreReader, RelationsStoreReader};
use crate::reachability::reachability_service::ReachabilityService;
use crate::types::{ghostdata::GhostdagData, ordering::*};
use anyhow::{bail, ensure, Context, Result};
use anyhow::{ensure, Context, Result};
use parking_lot::RwLock;
use starcoin_crypto::HashValue as Hash;
use starcoin_logger::prelude::*;
Expand Down Expand Up @@ -223,17 +223,6 @@ impl<
!= remote_blue_set
{
warn!("The data of blue set is not equal when executing the block: {:?}, for {:?}, checking data: {:?}", header.id(), blue_blocks.iter().map(|header| header.id()).collect::<Vec<_>>(), new_block_data.mergeset_blues);
let ghostdata = self.ghostdag(&header.parents_hash())?;
if ghostdata
.mergeset_blues
.iter()
.skip(1)
.cloned()
.collect::<HashSet<_>>()
!= remote_blue_set
{
bail!("The ghost data of blue set is not equal when executing the block: {:?}, for {:?}, checking data: {:?}", header.id(), blue_blocks.iter().map(|header| header.id()).collect::<Vec<_>>(), ghostdata.mergeset_blues);
}
}

let blue_score = self
Expand Down

0 comments on commit 799f99d

Please sign in to comment.