forked from cerc-io/laconicd-deprecated
fix : fix the chain start
This commit is contained in:
+25
-23
@@ -2,6 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/improbable-eng/grpc-web/go/grpcweb"
|
||||
@@ -42,31 +43,32 @@ func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator type
|
||||
}
|
||||
|
||||
func ConnectTmWS(tmRPCAddr, tmEndpoint string, logger tmlog.Logger) *rpcclient.WSClient {
|
||||
// tmWsClient, err := rpcclient.NewWS(tmRPCAddr, tmEndpoint,
|
||||
// rpcclient.MaxReconnectAttempts(256),
|
||||
// rpcclient.ReadWait(120*time.Second),
|
||||
// rpcclient.WriteWait(120*time.Second),
|
||||
// rpcclient.PingPeriod(50*time.Second),
|
||||
// rpcclient.OnReconnect(func() {
|
||||
// logger.Debug("EVM RPC reconnects to Tendermint WS", "address", tmRPCAddr+tmEndpoint)
|
||||
// }),
|
||||
// )
|
||||
tmWsClient, err := rpcclient.NewWSWithOptions(tmRPCAddr, tmEndpoint, rpcclient.WSOptions{
|
||||
MaxReconnectAttempts: 256, // first: 2 sec, last: 17 min.
|
||||
WriteWait: 120 * time.Second,
|
||||
ReadWait: 120 * time.Second,
|
||||
PingPeriod: 50 * time.Second,
|
||||
})
|
||||
|
||||
// if err != nil {
|
||||
// logger.Error(
|
||||
// "Tendermint WS client could not be created",
|
||||
// "address", tmRPCAddr+tmEndpoint,
|
||||
// "error", err,
|
||||
// )
|
||||
// } else if err := tmWsClient.OnStart(); err != nil {
|
||||
// logger.Error(
|
||||
// "Tendermint WS client could not start",
|
||||
// "address", tmRPCAddr+tmEndpoint,
|
||||
// "error", err,
|
||||
// )
|
||||
// }
|
||||
tmWsClient.OnReconnect(func() {
|
||||
logger.Debug("EVM RPC reconnects to Tendermint WS", "address", tmRPCAddr+tmEndpoint)
|
||||
})
|
||||
|
||||
return nil
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"Tendermint WS client could not be created",
|
||||
"address", tmRPCAddr+tmEndpoint,
|
||||
"error", err,
|
||||
)
|
||||
} else if err := tmWsClient.Start(); err != nil {
|
||||
logger.Error(
|
||||
"Tendermint WS client could not start",
|
||||
"address", tmRPCAddr+tmEndpoint,
|
||||
"error", err,
|
||||
)
|
||||
}
|
||||
|
||||
return tmWsClient
|
||||
}
|
||||
|
||||
func MountGRPCWebServices(
|
||||
|
||||
Reference in New Issue
Block a user