Skip to content

Commit

Permalink
Merge pull request #27 from kaiachain/scn-to-klay-rpc
Browse files Browse the repository at this point in the history
Fix service chain rpc
  • Loading branch information
blukat29 authored Jul 2, 2024
2 parents 5d638ff + c6141a5 commit cc66e83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions networks/rpc/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func StartIPCEndpoint(ipcEndpoint string, apis []API) (net.Listener, *Server, er
// Register all the APIs exposed by the services.
handler := NewServer()
for _, api := range apis {
if api.Namespace == "klay" {
api.Namespace = "kaia"
}

if err := handler.RegisterName(api.Namespace, api.Service); err != nil {
return nil, nil, err
}
Expand Down
9 changes: 8 additions & 1 deletion node/sc/mainbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,14 @@ func (mb *MainBridge) SetComponents(components []interface{}) {
case []rpc.API:
logger.Debug("p2p rpc registered", "len(v)", len(v))
for _, api := range v {
if api.Public && api.Namespace == "klay" {
// TODO-Kaia-RPC: cleanup
if api.Public && (api.Namespace == "klay" || api.Namespace == "kaia") {
api.Namespace = "klay"
logger.Error("p2p rpc registered", "namespace", api.Namespace)
if err := mb.rpcServer.RegisterName(api.Namespace, api.Service); err != nil {
logger.Error("pRPC failed to register", "namespace", api.Namespace)
}
api.Namespace = "kaia"
logger.Error("p2p rpc registered", "namespace", api.Namespace)
if err := mb.rpcServer.RegisterName(api.Namespace, api.Service); err != nil {
logger.Error("pRPC failed to register", "namespace", api.Namespace)
Expand Down

0 comments on commit cc66e83

Please sign in to comment.