Skip to content

Commit

Permalink
fix: disconnect on PoW peer message (#119)
Browse files Browse the repository at this point in the history
* fix: avoid disconnect on pow peer message

Signed-off-by: Gregory Edison <[email protected]>

* fix: revert changes

Signed-off-by: Gregory Edison <[email protected]>

* feat: set network mode as PoW in order to avoid dropping connections on `NewBlock` and `NewBlockHashes`

Signed-off-by: Gregory Edison <[email protected]>

---------

Signed-off-by: Gregory Edison <[email protected]>
  • Loading branch information
greged93 authored Jan 7, 2025
1 parent 46ed5d7 commit f364a2a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/scroll/node/src/builder/network.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use reth_network::{EthNetworkPrimitives, PeersInfo};
use reth_network::{
config::NetworkMode, EthNetworkPrimitives, NetworkConfig, NetworkManager, PeersInfo,
};
use reth_node_api::TxTy;
use reth_node_builder::{components::NetworkBuilder, BuilderContext, FullNodeTypes};
use reth_node_types::NodeTypes;
Expand Down Expand Up @@ -26,7 +28,11 @@ where
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<reth_network::NetworkHandle> {
let network = ctx.network_builder().await?;
// set the network mode to work.
let config = ctx.network_config()?;
let config = NetworkConfig { network_mode: NetworkMode::Work, ..config };

let network = NetworkManager::builder(config).await?;
let handle = ctx.start_network(network, pool);
info!(target: "reth::cli", enode=%handle.local_node_record(), "P2P networking initialized");
Ok(handle)
Expand Down

0 comments on commit f364a2a

Please sign in to comment.