refactors

geth Node api change

sd ctor refactor
This commit is contained in:
2020-11-16 17:49:59 +08:00
parent ca8b3066d1
commit abff9bf045
3 changed files with 14 additions and 9 deletions
+7 -5
View File
@@ -71,7 +71,7 @@ func serve() {
// create statediff service
logWithCommand.Info("creating statediff service")
db, err := postgres.NewDB(GetDBParams(), GetDBConfig(), nodeInfo)
db, err := postgres.NewDB(postgres.DbConnectionString(GetDBParams()), GetDBConfig(), nodeInfo)
if err != nil {
logWithCommand.Fatal(err)
}
@@ -127,9 +127,11 @@ func startServers(serv sd.IService) error {
}
if httpPath != "" {
logWithCommand.Info("starting up HTTP server")
if _, _, err := rpc.StartHTTPEndpoint(httpPath, serv.APIs(), []string{sd.APIName}, nil, nil, rpc.HTTPTimeouts{}); err != nil {
return err
}
// XXX broken https://github.com/ethereum/go-ethereum/pull/21105
// if _, _, err := node.StartHTTPEndpoint(httpPath, rpc.HTTPTimeouts{}, handler); err != nil {
// return err
// }
// or node.RegisterHandler ?
}
return nil
}
@@ -139,7 +141,7 @@ func chainConfig(chainID uint64) (*params.ChainConfig, error) {
case 1:
return params.MainnetChainConfig, nil
case 3:
return params.TestnetChainConfig, nil // Ropsten
return params.RopstenChainConfig, nil // Ropsten
case 4:
return params.RinkebyChainConfig, nil
case 5:
+1 -1
View File
@@ -68,7 +68,7 @@ func write() {
// create statediff service
logWithCommand.Info("creating statediff service")
db, err := postgres.NewDB(GetDBParams(), GetDBConfig(), nodeInfo)
db, err := postgres.NewDB(postgres.DbConnectionString(GetDBParams()), GetDBConfig(), nodeInfo)
if err != nil {
logWithCommand.Fatal(err)
}