diff --git a/crates/net/network/src/config.rs b/crates/net/network/src/config.rs index 324cd518916d..6047ab3caa1c 100644 --- a/crates/net/network/src/config.rs +++ b/crates/net/network/src/config.rs @@ -266,6 +266,17 @@ impl NetworkConfigBuilder { self } + /// Configures the network to use proof-of-work. + /// + /// This effectively allows block propagation in the `eth` sub-protocol, which has been + /// soft-deprecated with ethereum `PoS` after the merge. Even if block propagation is + /// technically allowed, according to the eth protocol, it is not expected to be used in `PoS` + /// networks and peers are supposed to terminate the connection if they receive a `NewBlock` + /// message. + pub const fn with_pow(self) -> Self { + self.network_mode(NetworkMode::Work) + } + /// Sets the highest synced block. /// /// This is used to construct the appropriate [`ForkFilter`] and [`Status`] message. diff --git a/examples/bsc-p2p/src/main.rs b/examples/bsc-p2p/src/main.rs index cea87918322b..a2dec469591b 100644 --- a/examples/bsc-p2p/src/main.rs +++ b/examples/bsc-p2p/src/main.rs @@ -55,6 +55,8 @@ async fn main() { // The network configuration let mut net_cfg = NetworkConfig::builder(secret_key) .listener_addr(local_addr) + // we need to explicitly set the network mode to PoW to allow block propagation, see docs + .with_pow() .build_with_noop_provider(bsc_chain_spec()) .set_discovery_v4( Discv4ConfigBuilder::default()