cmd/geth: add support for geth attach --testnet (#15597)
This commit is contained in:
parent
afb8154eab
commit
6e613cf3de
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
@ -114,8 +115,15 @@ func localConsole(ctx *cli.Context) error {
|
|||||||
func remoteConsole(ctx *cli.Context) error {
|
func remoteConsole(ctx *cli.Context) error {
|
||||||
// Attach to a remotely running geth instance and start the JavaScript console
|
// Attach to a remotely running geth instance and start the JavaScript console
|
||||||
endpoint := ctx.Args().First()
|
endpoint := ctx.Args().First()
|
||||||
if endpoint == "" && ctx.GlobalIsSet(utils.DataDirFlag.Name) {
|
if endpoint == "" {
|
||||||
endpoint = fmt.Sprintf("%s/geth.ipc", ctx.GlobalString(utils.DataDirFlag.Name))
|
path := node.DefaultDataDir()
|
||||||
|
if ctx.GlobalIsSet(utils.DataDirFlag.Name) {
|
||||||
|
path = ctx.GlobalString(utils.DataDirFlag.Name)
|
||||||
|
}
|
||||||
|
if path != "" && ctx.GlobalBool(utils.TestnetFlag.Name) {
|
||||||
|
path = filepath.Join(path, "testnet")
|
||||||
|
}
|
||||||
|
endpoint = fmt.Sprintf("%s/geth.ipc", path)
|
||||||
}
|
}
|
||||||
client, err := dialRPC(endpoint)
|
client, err := dialRPC(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user