fix: manually override certain chainconfig fields for adminNodeInfo (#8874)

This commit is contained in:
Matthias Seitz
2024-06-16 20:10:02 +02:00
committed by GitHub
parent 9b50226f56
commit ce0559d6c7

View File

@ -4,7 +4,7 @@ use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_network_api::{NetworkInfo, PeerKind, Peers};
use reth_network_peers::AnyNode;
use reth_primitives::{ChainSpec, NodeRecord};
use reth_primitives::{ChainConfig, ChainSpec, NodeRecord};
use reth_rpc_api::AdminApiServer;
use reth_rpc_types::{
admin::{EthProtocolInfo, NodeInfo, Ports, ProtocolInfo},
@ -94,7 +94,14 @@ where
async fn node_info(&self) -> RpcResult<NodeInfo> {
let enode = self.network.local_node_record();
let status = self.network.network_status().await.to_rpc_result()?;
let config = self.chain_spec.genesis().config.clone();
let config = ChainConfig {
chain_id: self.chain_spec.chain.id(),
terminal_total_difficulty_passed: self
.chain_spec
.get_final_paris_total_difficulty()
.is_some(),
..self.chain_spec.genesis().config.clone()
};
let node_info = NodeInfo {
id: B256::from_slice(&enode.id.as_slice()[..32]),