Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless non_owning_clone method for ChainController and NetworkController #4158

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ impl ChainController {
.into())
})
}

/// Since a non-owning reference does not count towards ownership,
/// it will not prevent the value stored in the allocation from being dropped
pub fn non_owning_clone(&self) -> Self {
ChainController {
truncate_sender: self.truncate_sender.clone(),
process_block_sender: self.process_block_sender.clone(),
}
}
}

/// The struct represent fork
Expand Down
4 changes: 2 additions & 2 deletions ckb-bin/src/subcommand/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ pub fn run(args: RunArgs, version: Version, async_handle: Handle) -> Result<(),

let (network_controller, _rpc_server) = launcher.start_network_and_rpc(
&shared,
chain_controller.non_owning_clone(),
chain_controller.clone(),
miner_enable,
pack.take_relay_tx_receiver(),
);

let tx_pool_builder = pack.take_tx_pool_builder();
tx_pool_builder.start(network_controller.non_owning_clone());
tx_pool_builder.start(network_controller.clone());

ctrlc::set_handler(|| {
info!("Trapped exit signal, exiting...");
Expand Down
11 changes: 0 additions & 11 deletions network/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1386,17 +1386,6 @@ impl NetworkController {
let _ignore = ping_controller.try_send(());
}
}

/// Since a non-owning reference does not count towards ownership,
/// it will not prevent the value stored in the allocation from being dropped
pub fn non_owning_clone(&self) -> Self {
NetworkController {
version: self.version.clone(),
network_state: Arc::clone(&self.network_state),
p2p_control: self.p2p_control.clone(),
ping_controller: self.ping_controller.clone(),
}
}
}

// Send an optional message before disconnect a peer
Expand Down
Loading