Add custom json-rpc method to initialize the trusted block root (#2805)
This commit is contained in:
parent
8d8f62bf67
commit
bef4c05561
|
@ -28,7 +28,7 @@ import
|
|||
./rpc/[
|
||||
rpc_eth_api, rpc_debug_api, rpc_discovery_api, rpc_portal_common_api,
|
||||
rpc_portal_history_api, rpc_portal_beacon_api, rpc_portal_state_api,
|
||||
rpc_portal_debug_history_api,
|
||||
rpc_portal_nimbus_beacon_api, rpc_portal_debug_history_api,
|
||||
],
|
||||
./database/content_db,
|
||||
./portal_node,
|
||||
|
@ -273,6 +273,7 @@ proc run(
|
|||
rpcServer.installPortalBeaconApiHandlers(
|
||||
node.beaconNetwork.value.portalProtocol
|
||||
)
|
||||
rpcServer.installPortalNimbusBeaconApiHandlers(node.beaconNetwork.value)
|
||||
if node.stateNetwork.isSome():
|
||||
rpcServer.installPortalCommonApiHandlers(
|
||||
node.stateNetwork.value.portalProtocol, PortalSubnetwork.state
|
||||
|
|
|
@ -357,7 +357,7 @@ proc validateContent(
|
|||
|
||||
debug "Received offered content validated successfully", contentKey
|
||||
else:
|
||||
error "Received offered content failed validation",
|
||||
debug "Received offered content failed validation",
|
||||
contentKey, error = validation.error
|
||||
return false
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# nimbus
|
||||
# Copyright (c) 2024 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
import json_rpc/rpcserver, ../network/beacon/beacon_network
|
||||
|
||||
export rpcserver
|
||||
|
||||
# Nimbus/fluffy specific RPC methods for the Portal beacon network.
|
||||
proc installPortalNimbusBeaconApiHandlers*(rpcServer: RpcServer, n: BeaconNetwork) =
|
||||
rpcServer.rpc("portal_nimbus_beaconSetTrustedBlockRoot") do(blockRoot: string) -> bool:
|
||||
let root = Digest.fromHex(blockRoot)
|
||||
n.trustedBlockRoot = Opt.some(root)
|
||||
true
|
Loading…
Reference in New Issue