aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/flags.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-07 19:39:52 +0800
committerFelix Lange <fjl@twurst.com>2015-03-07 19:39:52 +0800
commita2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b (patch)
treef9219d79707ce4a65177c5292478f971faa1d7c9 /cmd/utils/flags.go
parentd66f93cecdbae6a88bfb710e0d95d62340bf2460 (diff)
downloadgo-tangerine-a2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b.tar
go-tangerine-a2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b.tar.gz
go-tangerine-a2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b.tar.bz2
go-tangerine-a2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b.tar.lz
go-tangerine-a2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b.tar.xz
go-tangerine-a2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b.tar.zst
go-tangerine-a2810c06d7cfc64e1636fe4ecfd5e35cc52b0d2b.zip
cmd/ethereum: add account commands
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r--cmd/utils/flags.go48
1 files changed, 22 insertions, 26 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index fb80ac708..4f3ecd2b2 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -4,8 +4,10 @@ import (
"crypto/ecdsa"
"path"
"runtime"
+ "time"
"github.com/codegangsta/cli"
+ "github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
@@ -30,16 +32,6 @@ var (
Name: "vm",
Usage: "Virtual Machine type: 0 is standard VM, 1 is debug VM",
}
- KeyRingFlag = cli.StringFlag{
- Name: "keyring",
- Usage: "Name of keyring to be used",
- Value: "",
- }
- KeyStoreFlag = cli.StringFlag{
- Name: "keystore",
- Usage: `Where to store keyrings: "db" or "file"`,
- Value: "db",
- }
DataDirFlag = cli.StringFlag{
Name: "datadir",
Usage: "Data directory to be used",
@@ -145,22 +137,20 @@ func GetNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey) {
func GetEthereum(clientID, version string, ctx *cli.Context) *eth.Ethereum {
ethereum, err := eth.New(&eth.Config{
- Name: p2p.MakeName(clientID, version),
- KeyStore: ctx.GlobalString(KeyStoreFlag.Name),
- DataDir: ctx.GlobalString(DataDirFlag.Name),
- LogFile: ctx.GlobalString(LogFileFlag.Name),
- LogLevel: ctx.GlobalInt(LogLevelFlag.Name),
- LogFormat: ctx.GlobalString(LogFormatFlag.Name),
- MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
-
- MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
- Port: ctx.GlobalString(ListenPortFlag.Name),
- NAT: GetNAT(ctx),
- NodeKey: GetNodeKey(ctx),
- KeyRing: ctx.GlobalString(KeyRingFlag.Name),
- Shh: true,
- Dial: true,
- BootNodes: ctx.GlobalString(BootnodesFlag.Name),
+ Name: p2p.MakeName(clientID, version),
+ DataDir: ctx.GlobalString(DataDirFlag.Name),
+ LogFile: ctx.GlobalString(LogFileFlag.Name),
+ LogLevel: ctx.GlobalInt(LogLevelFlag.Name),
+ LogFormat: ctx.GlobalString(LogFormatFlag.Name),
+ MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
+ AccountManager: GetAccountManager(ctx),
+ MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
+ Port: ctx.GlobalString(ListenPortFlag.Name),
+ NAT: GetNAT(ctx),
+ NodeKey: GetNodeKey(ctx),
+ Shh: true,
+ Dial: true,
+ BootNodes: ctx.GlobalString(BootnodesFlag.Name),
})
if err != nil {
exit(err)
@@ -176,3 +166,9 @@ func GetChain(ctx *cli.Context) (*core.ChainManager, ethutil.Database) {
}
return core.NewChainManager(db, new(event.TypeMux)), db
}
+
+func GetAccountManager(ctx *cli.Context) *accounts.AccountManager {
+ dataDir := ctx.GlobalString(DataDirFlag.Name)
+ ks := crypto.NewKeyStorePassphrase(path.Join(dataDir, "keys"))
+ return accounts.NewAccountManager(ks, 300*time.Second)
+}