Skip to content

Commit

Permalink
remvoe unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzhhuang committed Oct 10, 2024
1 parent 115952f commit 7496afc
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions sync/src/block_connector/block_connector_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ use super::CreateBlockResponse;
use crate::block_connector::{
ExecuteRequest, MinerRequest, MinerResponse, ResetRequest, WriteBlockChainService,
};
use crate::store::sync_dag_store::SyncDagStore;
use crate::store::sync_dag_store::SyncDagStoreConfig;
use crate::sync::{CheckSyncEvent, SyncService};
use crate::tasks::{BlockConnectedEvent, BlockConnectedFinishEvent, BlockDiskCheckEvent};
use anyhow::{bail, format_err, Ok, Result};
use network_api::PeerProvider;
use starcoin_chain::BlockChain;
use starcoin_chain_api::{ChainReader, ConnectBlockError, WriteableChainService};
use starcoin_config::RocksdbConfig;
use starcoin_config::{NodeConfig, G_CRATE_VERSION};
use starcoin_consensus::Consensus;
use starcoin_crypto::HashValue;
Expand All @@ -33,7 +30,6 @@ use starcoin_service_registry::{
};
use starcoin_storage::{BlockStore, Storage};
use starcoin_sync_api::PeerNewBlock;
use starcoin_sync_api::SyncAsyncService;
use starcoin_txpool::TxPoolService;
use starcoin_txpool_api::TxPoolSyncService;
#[cfg(test)]
Expand Down Expand Up @@ -356,26 +352,7 @@ impl<TransactionPoolServiceT> ServiceHandler<Self, ResetRequest>
where
TransactionPoolServiceT: TxPoolSyncService + 'static,
{
fn handle(&mut self, msg: ResetRequest, ctx: &mut ServiceContext<Self>) -> Result<()> {
// cancel the sync to avoid the db writing conflict
let sync_service = ctx.service_ref::<SyncService>()?.clone();
async_std::task::block_on(async {
sync_service.cancel().await?;
anyhow::Ok(())
})?;

let config = ctx.get_shared::<Arc<NodeConfig>>()?;

let sync_dag_store = SyncDagStore::create_from_path(
config.storage.sync_dir(),
SyncDagStoreConfig::create_with_params(
config.storage.cache_size(),
RocksdbConfig::default(),
),
)?;

sync_dag_store.delete_all_dag_sync_block()?;

fn handle(&mut self, msg: ResetRequest, _ctx: &mut ServiceContext<Self>) -> Result<()> {
self.chain_service.reset(msg.block_hash)
}
}
Expand Down

0 comments on commit 7496afc

Please sign in to comment.