[devnet tool] fixing port conflicts (#7520)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2023-05-15 20:31:35 +01:00 committed by GitHub
parent 4cbbe65f31
commit 90cb6be425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 23 deletions

View File

@ -12,7 +12,6 @@ import (
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutility"
"github.com/ledgerwatch/erigon/cmd/devnet/models"
"github.com/ledgerwatch/erigon/cmd/rpctest/rpctest"
"github.com/ledgerwatch/erigon/common/hexutil"
"github.com/ledgerwatch/erigon/crypto"
@ -30,19 +29,6 @@ func ClearDevDB(dataDir string, logger log.Logger) error {
return nil
}
func DeleteLogs(dataDir string, logger log.Logger) error {
log.Info("Removing old logs to create new ones...")
log.Info("Before re-running the devnet tool, make sure to copy out old logs if you need them!!!")
if err := os.RemoveAll(models.LogDirParam); err != nil {
return err
}
if err := os.RemoveAll("./erigon_node_2"); err != nil {
return err
}
return nil
}
// UniqueIDFromEnode returns the unique ID from a node's enode, removing the `?discport=0` part
func UniqueIDFromEnode(enode string) (string, error) {
if len(enode) == 0 {

View File

@ -60,11 +60,6 @@ func action(ctx *cli.Context) error {
// wait group variable to prevent main function from terminating until routines are finished
var wg sync.WaitGroup
// remove the old logs from previous runs
if err := devnetutils.DeleteLogs(dataDir, logger); err != nil {
return err
}
// start the first erigon node in a go routine
node.Start(&wg, dataDir, logger)

View File

@ -66,7 +66,7 @@ const (
// TorrentPortParam is the port parameter for the second node
TorrentPortParam = "42070"
// PrivateApiParamMine is the private.api.addr parameter for the mining node
PrivateApiParamMine = "localhost:9090"
PrivateApiParamMine = "localhost:9092"
// PrivateApiParamNoMine is the private.api.addr parameter for the non-mining node
PrivateApiParamNoMine = "localhost:9091"
// HttpApiParam is the http.api default parameter for rpcdaemon

View File

@ -111,8 +111,9 @@ func miningNodeArgs(dataDir string, nodeNumber int) []string {
ws := models.WSArg
consoleVerbosity, _ := models.ParameterFromArgument(models.ConsoleVerbosityArg, models.ConsoleVerbosityParam)
p2pProtocol, _ := models.ParameterFromArgument("--p2p.protocol", "68")
downloaderArg, _ := models.ParameterFromArgument("--no-downloader", "true")
return []string{models.BuildDirArg, dataDirArg, chainType, privateApiAddr, models.Mine, httpApi, ws, devPeriod, consoleVerbosity, p2pProtocol}
return []string{models.BuildDirArg, dataDirArg, chainType, privateApiAddr, models.Mine, httpApi, ws, devPeriod, consoleVerbosity, p2pProtocol, downloaderArg}
}
// nonMiningNodeArgs returns custom args for starting a non-mining node
@ -125,8 +126,9 @@ func nonMiningNodeArgs(dataDir string, nodeNumber int, enode string) []string {
consoleVerbosity, _ := models.ParameterFromArgument(models.ConsoleVerbosityArg, models.ConsoleVerbosityParam)
torrentPort, _ := models.ParameterFromArgument(models.TorrentPortArg, models.TorrentPortParam)
p2pProtocol, _ := models.ParameterFromArgument("--p2p.protocol", "68")
downloaderArg, _ := models.ParameterFromArgument("--no-downloader", "true")
return []string{models.BuildDirArg, dataDirArg, chainType, privateApiAddr, staticPeers, models.NoDiscover, consoleVerbosity, torrentPort, p2pProtocol}
return []string{models.BuildDirArg, dataDirArg, chainType, privateApiAddr, staticPeers, models.NoDiscover, consoleVerbosity, torrentPort, p2pProtocol, downloaderArg}
}
// getEnode returns the enode of the mining node

View File

@ -49,7 +49,7 @@ var DefaultConfig = Config{
WSModules: []string{"net", "web3"},
P2P: p2p.Config{
ListenAddr: ":30303",
ProtocolVersion: []uint{direct.ETH68, direct.ETH67, direct.ETH66},
ProtocolVersion: []uint{direct.ETH68, direct.ETH67}, // No need to specify direct.ETH66, because 1 sentry is used for both 66 and 67
MaxPeers: 100,
MaxPendingPeers: 1000,
NAT: nat.Any(),