fix: curio: Start BoostAdapters before blocking rpc serve (#11871)

* fix: curio: Start BoostAdapters before blocking rpc serve

* curio/lmrpc: Override unspecified rpc address to localhost
This commit is contained in:
Łukasz Magiera 2024-04-15 17:19:53 +02:00 committed by GitHub
parent 11cdb27bbb
commit ae15eb1922
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 10 deletions

View File

@ -131,15 +131,15 @@ var runCmd = &cli.Command{
} }
defer taskEngine.GracefullyTerminate() defer taskEngine.GracefullyTerminate()
if err := lmrpc.ServeCurioMarketRPCFromConfig(dependencies.DB, dependencies.Full, dependencies.Cfg); err != nil {
return xerrors.Errorf("starting market RPCs: %w", err)
}
err = rpc.ListenAndServe(ctx, dependencies, shutdownChan) // Monitor for shutdown. err = rpc.ListenAndServe(ctx, dependencies, shutdownChan) // Monitor for shutdown.
if err != nil { if err != nil {
return err return err
} }
if err := lmrpc.ServeCurioMarketRPCFromConfig(dependencies.DB, dependencies.Full, dependencies.Cfg); err != nil {
return xerrors.Errorf("starting market RPCs: %w", err)
}
finishCh := node.MonitorShutdown(shutdownChan) //node.ShutdownHandler{Component: "rpc server", StopFunc: rpcStopper}, finishCh := node.MonitorShutdown(shutdownChan) //node.ShutdownHandler{Component: "rpc server", StopFunc: rpcStopper},
//node.ShutdownHandler{Component: "curio", StopFunc: stop}, //node.ShutdownHandler{Component: "curio", StopFunc: stop},

View File

@ -68,9 +68,8 @@ func MakeTokens(cfg *config.CurioConfig) (map[address.Address]string, error) {
return xerrors.Errorf("net resolve: %w", err) return xerrors.Errorf("net resolve: %w", err)
} }
if len(laddr.IP) == 0 { if len(laddr.IP) == 0 || laddr.IP.IsUnspecified() {
// set localhost return xerrors.Errorf("market rpc server listen address must be a specific address, not %s (probably missing bind IP)", listen)
laddr.IP = net.IPv4(127, 0, 0, 1)
} }
// need minimal provider with just the config // need minimal provider with just the config
@ -171,9 +170,8 @@ func ServeCurioMarketRPC(db *harmonydb.DB, full api.FullNode, maddr address.Addr
return xerrors.Errorf("net resolve: %w", err) return xerrors.Errorf("net resolve: %w", err)
} }
if len(laddr.IP) == 0 { if len(laddr.IP) == 0 || laddr.IP.IsUnspecified() {
// set localhost return xerrors.Errorf("market rpc server listen address must be a specific address, not %s (probably missing bind IP)", listen)
laddr.IP = net.IPv4(127, 0, 0, 1)
} }
rootUrl := url.URL{ rootUrl := url.URL{
Scheme: "http", Scheme: "http",