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
46e55839
Commit
46e55839
authored
Dec 09, 2017
by
Péter Szilágyi
Committed by
Felix Lange
Dec 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/utils, eth: init etherbase from within eth (#15528)
parent
bf62acf0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
flags.go
cmd/utils/flags.go
+6
-9
backend.go
eth/backend.go
+9
-2
No files found.
cmd/utils/flags.go
View file @
46e55839
...
...
@@ -746,6 +746,12 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
if
err
!=
nil
||
index
<
0
{
return
accounts
.
Account
{},
fmt
.
Errorf
(
"invalid account address or index %q"
,
account
)
}
log
.
Warn
(
"-------------------------------------------------------------------"
)
log
.
Warn
(
"Referring to accounts by order in the keystore folder is dangerous!"
)
log
.
Warn
(
"This functionality is deprecated and will be removed in the future!"
)
log
.
Warn
(
"Please use explicit addresses! (can search via `geth account list`)"
)
log
.
Warn
(
"-------------------------------------------------------------------"
)
accs
:=
ks
.
Accounts
()
if
len
(
accs
)
<=
index
{
return
accounts
.
Account
{},
fmt
.
Errorf
(
"index %d higher than number of accounts %d"
,
index
,
len
(
accs
))
...
...
@@ -762,15 +768,6 @@ func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) {
Fatalf
(
"Option %q: %v"
,
EtherbaseFlag
.
Name
,
err
)
}
cfg
.
Etherbase
=
account
.
Address
return
}
accounts
:=
ks
.
Accounts
()
if
(
cfg
.
Etherbase
==
common
.
Address
{})
{
if
len
(
accounts
)
>
0
{
cfg
.
Etherbase
=
accounts
[
0
]
.
Address
}
else
{
log
.
Warn
(
"No etherbase set and no accounts found as default"
)
}
}
}
...
...
eth/backend.go
View file @
46e55839
...
...
@@ -310,10 +310,17 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) {
}
if
wallets
:=
s
.
AccountManager
()
.
Wallets
();
len
(
wallets
)
>
0
{
if
accounts
:=
wallets
[
0
]
.
Accounts
();
len
(
accounts
)
>
0
{
return
accounts
[
0
]
.
Address
,
nil
etherbase
:=
accounts
[
0
]
.
Address
s
.
lock
.
Lock
()
s
.
etherbase
=
etherbase
s
.
lock
.
Unlock
()
log
.
Info
(
"Etherbase automatically configured"
,
"address"
,
etherbase
)
return
etherbase
,
nil
}
}
return
common
.
Address
{},
fmt
.
Errorf
(
"etherbase
address
must be explicitly specified"
)
return
common
.
Address
{},
fmt
.
Errorf
(
"etherbase must be explicitly specified"
)
}
// set in js console via admin interface or wrapper from cli flags
...
...
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