forked from cerc-io/plugeth
commit
848e50d6fb
@ -284,6 +284,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
|
|||||||
utils.GenesisFileFlag,
|
utils.GenesisFileFlag,
|
||||||
utils.BootnodesFlag,
|
utils.BootnodesFlag,
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
|
utils.KeyStoreDirFlag,
|
||||||
utils.BlockchainVersionFlag,
|
utils.BlockchainVersionFlag,
|
||||||
utils.OlympicFlag,
|
utils.OlympicFlag,
|
||||||
utils.FastSyncFlag,
|
utils.FastSyncFlag,
|
||||||
|
@ -63,6 +63,7 @@ var AppHelpFlagGroups = []flagGroup{
|
|||||||
Name: "ETHEREUM",
|
Name: "ETHEREUM",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
|
utils.KeyStoreDirFlag,
|
||||||
utils.NetworkIdFlag,
|
utils.NetworkIdFlag,
|
||||||
utils.OlympicFlag,
|
utils.OlympicFlag,
|
||||||
utils.TestNetFlag,
|
utils.TestNetFlag,
|
||||||
|
@ -102,6 +102,10 @@ var (
|
|||||||
Usage: "Data directory for the databases and keystore",
|
Usage: "Data directory for the databases and keystore",
|
||||||
Value: DirectoryString{common.DefaultDataDir()},
|
Value: DirectoryString{common.DefaultDataDir()},
|
||||||
}
|
}
|
||||||
|
KeyStoreDirFlag = DirectoryFlag{
|
||||||
|
Name: "keystore",
|
||||||
|
Usage: "Directory for the keystore (default = inside the datadir)",
|
||||||
|
}
|
||||||
NetworkIdFlag = cli.IntFlag{
|
NetworkIdFlag = cli.IntFlag{
|
||||||
Name: "networkid",
|
Name: "networkid",
|
||||||
Usage: "Network identifier (integer, 0=Olympic, 1=Frontier, 2=Morden)",
|
Usage: "Network identifier (integer, 0=Olympic, 1=Frontier, 2=Morden)",
|
||||||
@ -393,6 +397,16 @@ func MustMakeDataDir(ctx *cli.Context) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MakeKeyStoreDir resolves the folder to use for storing the account keys from the
|
||||||
|
// set command line flags, returning the explicitly requested path, or one inside
|
||||||
|
// the data directory otherwise.
|
||||||
|
func MakeKeyStoreDir(datadir string, ctx *cli.Context) string {
|
||||||
|
if path := ctx.GlobalString(KeyStoreDirFlag.Name); path != "" {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
return filepath.Join(datadir, "keystore")
|
||||||
|
}
|
||||||
|
|
||||||
// MakeIPCPath creates an IPC path configuration from the set command line flags,
|
// MakeIPCPath creates an IPC path configuration from the set command line flags,
|
||||||
// returning an empty string if IPC was explicitly disabled, or the set path.
|
// returning an empty string if IPC was explicitly disabled, or the set path.
|
||||||
func MakeIPCPath(ctx *cli.Context) string {
|
func MakeIPCPath(ctx *cli.Context) string {
|
||||||
@ -526,7 +540,8 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
|
|||||||
// Assemble an account manager using the configured datadir
|
// Assemble an account manager using the configured datadir
|
||||||
var (
|
var (
|
||||||
datadir = MustMakeDataDir(ctx)
|
datadir = MustMakeDataDir(ctx)
|
||||||
keystore = crypto.NewKeyStorePassphrase(filepath.Join(datadir, "keystore"), scryptN, scryptP)
|
keystoredir = MakeKeyStoreDir(datadir, ctx)
|
||||||
|
keystore = crypto.NewKeyStorePassphrase(keystoredir, scryptN, scryptP)
|
||||||
)
|
)
|
||||||
return accounts.NewManager(keystore)
|
return accounts.NewManager(keystore)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user