fix: Always forward transactions to upstream

This commit is contained in:
sprites0
2025-07-05 03:09:13 +00:00
parent 450e228a8f
commit 278d3608b1
2 changed files with 11 additions and 7 deletions

View File

@ -26,23 +26,25 @@ fn main() -> eyre::Result<()> {
}
Cli::<HlChainSpecParser, HlNodeArgs>::parse().run(|builder, ext| async move {
let default_upstream_rpc_url = builder.config().chain.official_rpc_url();
builder.builder.database.create_tables_for::<Tables>()?;
let (node, engine_handle_tx) =
HlNode::new(ext.block_source_args.parse().await?, ext.hl_node_compliant);
let NodeHandle { node, node_exit_future: exit_future } = builder
.node(node)
.extend_rpc_modules(move |ctx| {
let upstream_rpc_url = ext.upstream_rpc_url;
if let Some(upstream_rpc_url) = upstream_rpc_url {
ctx.modules.replace_configured(
tx_forwarder::EthForwarderExt::new(upstream_rpc_url.clone()).into_rpc(),
)?;
let upstream_rpc_url =
ext.upstream_rpc_url.unwrap_or_else(|| default_upstream_rpc_url.to_owned());
info!("Transaction forwarding enabled");
}
ctx.modules.replace_configured(
tx_forwarder::EthForwarderExt::new(upstream_rpc_url.clone()).into_rpc(),
)?;
info!("Transaction will be forwarded to {}", upstream_rpc_url);
if ext.hl_node_compliant {
install_hl_node_compliance(ctx)?;
info!("hl-node compliant mode enabled");
}
Ok(())