Skip to content

Commit ae359c3

Browse files
modify tree task
1 parent 6bf31d0 commit ae359c3

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

crates/chainspec/src/spec.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ use reth_ethereum_forks::{
1111
ForkFilter, ForkFilterKey, ForkHash, ForkId, Hardfork, Head, DEV_HARDFORKS,
1212
};
1313
use reth_network_peers::{
14-
base_nodes, base_testnet_nodes, holesky_nodes, mainnet_nodes, op_nodes, op_testnet_nodes,
14+
base_nodes, base_testnet_nodes, bsc_mainnet_nodes, bsc_testnet_nodes, holesky_nodes,
15+
mainnet_nodes, op_nodes, op_testnet_nodes, opbnb_mainnet_nodes, opbnb_testnet_nodes,
1516
sepolia_nodes, NodeRecord,
1617
};
17-
#[cfg(feature = "bsc")]
18-
use reth_network_peers::{bsc_mainnet_nodes, bsc_testnet_nodes};
19-
#[cfg(feature = "opbnb")]
20-
use reth_network_peers::{opbnb_mainnet_nodes, opbnb_testnet_nodes};
2118
use reth_primitives_traits::{
2219
constants::{
2320
DEV_GENESIS_HASH, EIP1559_INITIAL_BASE_FEE, EMPTY_WITHDRAWALS, ETHEREUM_BLOCK_GAS_LIMIT,

crates/engine/tree/src/tree/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,16 @@ where
630630
);
631631
task.set_invalid_block_hook(invalid_block_hook);
632632
let incoming = task.incoming_tx.clone();
633-
std::thread::Builder::new().name("Tree Task".to_string()).spawn(|| task.run()).unwrap();
633+
std::thread::Builder::new()
634+
.name("Tree Task".to_string())
635+
.spawn(move || {
636+
let runtime =
637+
tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
638+
runtime.block_on(async {
639+
task.run();
640+
});
641+
})
642+
.unwrap();
634643
(incoming, outgoing)
635644
}
636645

@@ -1203,8 +1212,11 @@ where
12031212
EngineApiRequest::Beacon(request) => {
12041213
match request {
12051214
BeaconEngineMessage::ForkchoiceUpdated { state, payload_attrs, tx } => {
1215+
let start = Instant::now();
12061216
let mut output = self.on_forkchoice_updated(state, payload_attrs);
1217+
debug!("Forkchoice updated took {:?}", start.elapsed());
12071218

1219+
let start = Instant::now();
12081220
if let Ok(res) = &mut output {
12091221
// track last received forkchoice state
12101222
self.state
@@ -1220,12 +1232,15 @@ where
12201232
// handle the event if any
12211233
self.on_maybe_tree_event(res.event.take())?;
12221234
}
1235+
debug!("Sending response to beacon1 took {:?}", start.elapsed());
12231236

1237+
let start = Instant::now();
12241238
if let Err(err) =
12251239
tx.send(output.map(|o| o.outcome).map_err(Into::into))
12261240
{
12271241
error!("Failed to send event: {err:?}");
12281242
}
1243+
debug!("Sent response to beacon2 took {:?}", start.elapsed());
12291244
}
12301245
BeaconEngineMessage::NewPayload { payload, cancun_fields, tx } => {
12311246
let output = self.on_new_payload(payload, cancun_fields);

0 commit comments

Comments
 (0)