Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
629f4b1d
Commit
629f4b1d
authored
Mar 11, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
239e17de
99bc44cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
16 deletions
+29
-16
main.go
cmd/ethereum/main.go
+18
-13
flags.go
cmd/utils/flags.go
+11
-3
No files found.
cmd/ethereum/main.go
View file @
629f4b1d
...
...
@@ -129,6 +129,7 @@ runtime will execute the file and exit.
utils
.
RPCEnabledFlag
,
utils
.
RPCListenAddrFlag
,
utils
.
RPCPortFlag
,
utils
.
UnencryptedKeysFlag
,
utils
.
VMDebugFlag
,
//utils.VMTypeFlag,
}
...
...
@@ -230,20 +231,24 @@ func accountList(ctx *cli.Context) {
func
accountCreate
(
ctx
*
cli
.
Context
)
{
am
:=
utils
.
GetAccountManager
(
ctx
)
fmt
.
Println
(
"The new account will be encrypted with a passphrase."
)
fmt
.
Println
(
"Please enter a passphrase now."
)
auth
,
err
:=
readPassword
(
"Passphrase: "
,
true
)
if
err
!=
nil
{
utils
.
Fatalf
(
"%v"
,
err
)
}
confirm
,
err
:=
readPassword
(
"Repeat Passphrase: "
,
false
)
if
err
!=
nil
{
utils
.
Fatalf
(
"%v"
,
err
)
}
if
auth
!=
confirm
{
utils
.
Fatalf
(
"Passphrases did not match."
)
passphrase
:=
""
if
!
ctx
.
GlobalBool
(
utils
.
UnencryptedKeysFlag
.
Name
)
{
fmt
.
Println
(
"The new account will be encrypted with a passphrase."
)
fmt
.
Println
(
"Please enter a passphrase now."
)
auth
,
err
:=
readPassword
(
"Passphrase: "
,
true
)
if
err
!=
nil
{
utils
.
Fatalf
(
"%v"
,
err
)
}
confirm
,
err
:=
readPassword
(
"Repeat Passphrase: "
,
false
)
if
err
!=
nil
{
utils
.
Fatalf
(
"%v"
,
err
)
}
if
auth
!=
confirm
{
utils
.
Fatalf
(
"Passphrases did not match."
)
}
passphrase
=
auth
}
acct
,
err
:=
am
.
NewAccount
(
auth
)
acct
,
err
:=
am
.
NewAccount
(
passphrase
)
if
err
!=
nil
{
utils
.
Fatalf
(
"Could not create the account: %v"
,
err
)
}
...
...
cmd/utils/flags.go
View file @
629f4b1d
...
...
@@ -99,6 +99,10 @@ var (
Name
:
"mine"
,
Usage
:
"Enable mining"
,
}
UnencryptedKeysFlag
=
cli
.
BoolFlag
{
Name
:
"unencrypted-keys"
,
Usage
:
"disable private key disk encryption (for testing)"
,
}
LogFileFlag
=
cli
.
StringFlag
{
Name
:
"logfile"
,
...
...
@@ -224,9 +228,13 @@ func GetChain(ctx *cli.Context) (*core.ChainManager, ethutil.Database, ethutil.D
func
GetAccountManager
(
ctx
*
cli
.
Context
)
*
accounts
.
Manager
{
dataDir
:=
ctx
.
GlobalString
(
DataDirFlag
.
Name
)
ks
:=
crypto
.
NewKeyStorePassphrase
(
path
.
Join
(
dataDir
,
"keys"
))
km
:=
accounts
.
NewManager
(
ks
)
return
km
var
ks
crypto
.
KeyStore2
if
ctx
.
GlobalBool
(
UnencryptedKeysFlag
.
Name
)
{
ks
=
crypto
.
NewKeyStorePlain
(
path
.
Join
(
dataDir
,
"plainkeys"
))
}
else
{
ks
=
crypto
.
NewKeyStorePassphrase
(
path
.
Join
(
dataDir
,
"keys"
))
}
return
accounts
.
NewManager
(
ks
)
}
func
StartRPC
(
eth
*
eth
.
Ethereum
,
ctx
*
cli
.
Context
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment