Skip to content

Commit

Permalink
Modified op-reth to always use all OP bootnodes when none are explici…
Browse files Browse the repository at this point in the history
…tly provided. #14603

this is the linked git issue #14603
  • Loading branch information
Ayushdubey86 authored Feb 20, 2025
1 parent c4066b0 commit 258a42a
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,14 +695,17 @@ impl OpNetworkBuilder {
builder = builder.disable_discv4_discovery();
}
if !args.discovery.disable_discovery {
let mut bootnodes = ctx.config().network.resolved_bootnodes()
.or_else(|| ctx.chain_spec().bootnodes())
.unwrap_or_default();

if bootnodes.is_empty() {
bootnodes = get_all_op_bootnodes(ctx);
}
builder = builder.discovery_v5(
args.discovery.discovery_v5_builder(
rlpx_socket,
ctx.config()
.network
.resolved_bootnodes()
.or_else(|| ctx.chain_spec().bootnodes())
.unwrap_or_default(),
bootnodes,
),
);
}
Expand All @@ -721,6 +724,19 @@ impl OpNetworkBuilder {
}
}

fn get_all_op_bootnodes<Node>(ctx: &BuilderContext<Node>) -> Vec<Bootnode>
where
Node: FullNodeTypes<Types: NodeTypes<ChainSpec: Hardforks>>,
{
let network_name = ctx.config().chain.chain.clone().to_lowercase();

if network_name.contains("mainnet") {
params::V5OPBootnodes.to_vec()
} else {
params::V5OPTestnetBootnodes.to_vec()
}
}

impl<Node, Pool> NetworkBuilder<Node, Pool> for OpNetworkBuilder
where
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = OpChainSpec, Primitives = OpPrimitives>>,
Expand Down

0 comments on commit 258a42a

Please sign in to comment.