fixed retesteth

This commit is contained in:
renaynay 2020-03-24 21:37:48 +01:00
parent 46eb11c667
commit 62bb958471
No known key found for this signature in database
GPG key ID: 731E44FAAFCD0274

View file

@ -21,6 +21,8 @@ import (
"context" "context"
"fmt" "fmt"
"math/big" "math/big"
"os"
"os/signal"
"strings" "strings"
"time" "time"
@ -38,6 +40,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
@ -846,68 +849,74 @@ func splitAndTrim(input string) []string {
} }
func retesteth(ctx *cli.Context) error { // TODO uncomment and fix test func retesteth(ctx *cli.Context) error { // TODO uncomment and fix test
//log.Info("Welcome to retesteth!") log.Info("Welcome to retesteth!")
//// register signer API with server // register signer API with server
//var ( var (
// extapiURL string extapiURL string
//) )
//apiImpl := &RetestethAPI{} apiImpl := &RetestethAPI{}
//var testApi RetestethTestAPI = apiImpl var testApi RetestethTestAPI = apiImpl
//var ethApi RetestethEthAPI = apiImpl var ethApi RetestethEthAPI = apiImpl
//var debugApi RetestethDebugAPI = apiImpl var debugApi RetestethDebugAPI = apiImpl
//var web3Api RetestWeb3API = apiImpl var web3Api RetestWeb3API = apiImpl
//rpcAPI := []rpc.API{ rpcAPI := []rpc.API{
// { {
// Namespace: "test", Namespace: "test",
// Public: true, Public: true,
// Service: testApi, Service: testApi,
// Version: "1.0", Version: "1.0",
// }, },
// { {
// Namespace: "eth", Namespace: "eth",
// Public: true, Public: true,
// Service: ethApi, Service: ethApi,
// Version: "1.0", Version: "1.0",
// }, },
// { {
// Namespace: "debug", Namespace: "debug",
// Public: true, Public: true,
// Service: debugApi, Service: debugApi,
// Version: "1.0", Version: "1.0",
// }, },
// { {
// Namespace: "web3", Namespace: "web3",
// Public: true, Public: true,
// Service: web3Api, Service: web3Api,
// Version: "1.0", Version: "1.0",
// }, },
//} }
//vhosts := splitAndTrim(ctx.GlobalString(utils.RPCVirtualHostsFlag.Name)) vhosts := splitAndTrim(ctx.GlobalString(utils.RPCVirtualHostsFlag.Name))
//cors := splitAndTrim(ctx.GlobalString(utils.RPCCORSDomainFlag.Name)) cors := splitAndTrim(ctx.GlobalString(utils.RPCCORSDomainFlag.Name))
// wsOrigins := splitAndTrim(ctx.GlobalString(utils.WSAllowedOriginsFlag.Value))
//// start http server
//var RetestethHTTPTimeouts = rpc.HTTPTimeouts{ srv := rpc.NewServer()
// ReadTimeout: 120 * time.Second,
// WriteTimeout: 120 * time.Second, handler := rpc.NewHTTPHandlerStack(srv, cors, vhosts)
// IdleTimeout: 120 * time.Second, handler = rpc.NewWebsocketUpgradeHandler(handler, srv.WebsocketHandler(wsOrigins))
//}
//httpEndpoint := fmt.Sprintf("%s:%d", ctx.GlobalString(utils.RPCListenAddrFlag.Name), ctx.Int(rpcPortFlag.Name)) // start http server
//listener, err := rpc.StartHTTPEndpoint(httpEndpoint, rpcAPI, []string{"test", "eth", "debug", "web3"}, RetestethHTTPTimeouts, ) var RetestethHTTPTimeouts = rpc.HTTPTimeouts{
//if err != nil { ReadTimeout: 120 * time.Second,
// utils.Fatalf("Could not start RPC api: %v", err) WriteTimeout: 120 * time.Second,
//} IdleTimeout: 120 * time.Second,
//extapiURL = fmt.Sprintf("http://%s", httpEndpoint) }
//log.Info("HTTP endpoint opened", "url", extapiURL) httpEndpoint := fmt.Sprintf("%s:%d", ctx.GlobalString(utils.RPCListenAddrFlag.Name), ctx.Int(rpcPortFlag.Name))
// listener, err := rpc.StartHTTPEndpoint(httpEndpoint, rpcAPI, []string{"test", "eth", "debug", "web3"}, RetestethHTTPTimeouts, handler)
//defer func() { if err != nil {
// listener.Close() utils.Fatalf("Could not start RPC api: %v", err)
// log.Info("HTTP endpoint closed", "url", httpEndpoint) }
//}() extapiURL = fmt.Sprintf("http://%s", httpEndpoint)
// log.Info("HTTP endpoint opened", "url", extapiURL)
//abortChan := make(chan os.Signal, 11)
//signal.Notify(abortChan, os.Interrupt) defer func() {
// listener.Close()
//sig := <-abortChan log.Info("HTTP endpoint closed", "url", httpEndpoint)
//log.Info("Exiting...", "signal", sig) }()
abortChan := make(chan os.Signal, 11)
signal.Notify(abortChan, os.Interrupt)
sig := <-abortChan
log.Info("Exiting...", "signal", sig)
return nil return nil
} }