mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
This reverts commit b8c3880254
.
This commit is contained in:
parent
55219d7ad3
commit
b652768241
@ -2,14 +2,14 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/ledgerwatch/turbo-geth/cmd/utils"
|
||||
"github.com/ledgerwatch/turbo-geth/eth/stagedsync"
|
||||
"github.com/ledgerwatch/turbo-geth/log"
|
||||
turbocli "github.com/ledgerwatch/turbo-geth/turbo/cli"
|
||||
"github.com/ledgerwatch/turbo-geth/turbo/node"
|
||||
|
||||
turbocli "github.com/ledgerwatch/turbo-geth/turbo/cli"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@ -26,22 +26,15 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func runTurboGeth(cliCtx *cli.Context) {
|
||||
func runTurboGeth(ctx *cli.Context) {
|
||||
// creating staged sync with all default parameters
|
||||
sync := stagedsync.New(
|
||||
stagedsync.DefaultStages(),
|
||||
stagedsync.DefaultUnwindOrder(),
|
||||
)
|
||||
|
||||
ctx := utils.RootContext()
|
||||
|
||||
// initializing the node and providing the current git commit there
|
||||
tg := node.New(cliCtx, sync, node.Params{GitCommit: gitCommit})
|
||||
tg.SetP2PListenFunc(func(network, addr string) (net.Listener, error) {
|
||||
var lc net.ListenConfig
|
||||
return lc.Listen(ctx, network, addr)
|
||||
})
|
||||
tg := node.New(ctx, sync, node.Params{GitCommit: gitCommit})
|
||||
// running the node
|
||||
err := tg.Serve()
|
||||
|
||||
|
@ -19,7 +19,6 @@ package node
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -143,10 +142,6 @@ func New(conf *Config) (*Node, error) {
|
||||
return node, nil
|
||||
}
|
||||
|
||||
func (n *Node) SetP2PListenFunc(listenFunc func(network, addr string) (net.Listener, error)) {
|
||||
n.server.SetP2PListenFunc(listenFunc)
|
||||
}
|
||||
|
||||
// Start starts all registered lifecycles, RPC services and p2p networking.
|
||||
// Node can only be started once.
|
||||
func (n *Node) Start() error {
|
||||
|
@ -314,10 +314,6 @@ func (srv *Server) Peers() []*Peer {
|
||||
return ps
|
||||
}
|
||||
|
||||
func (srv *Server) SetP2PListenFunc(listenFunc func(network, addr string) (net.Listener, error)) {
|
||||
srv.listenFunc = listenFunc
|
||||
}
|
||||
|
||||
// PeerCount returns the number of connected peers.
|
||||
func (srv *Server) PeerCount() int {
|
||||
var count int
|
||||
|
@ -3,7 +3,6 @@ package node
|
||||
|
||||
import (
|
||||
"math"
|
||||
"net"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"time"
|
||||
@ -29,10 +28,6 @@ type TurboGethNode struct {
|
||||
backend *eth.Ethereum
|
||||
}
|
||||
|
||||
func (tg *TurboGethNode) SetP2PListenFunc(listenFunc func(network, addr string) (net.Listener, error)) {
|
||||
tg.stack.SetP2PListenFunc(listenFunc)
|
||||
}
|
||||
|
||||
// Serve runs the node and blocks the execution. It returns when the node is existed.
|
||||
func (tg *TurboGethNode) Serve() error {
|
||||
defer tg.stack.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user