Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
d648e96b
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d648e96b
编写于
12月 01, 2015
作者:
F
Felix Lange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cmd/utils: restore starting geth without any accounts and etherbase
Also remove some duplication around address/index parsing.
上级
f4a6470a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
21 deletion
+18
-21
cmd/geth/main.go
cmd/geth/main.go
+5
-2
cmd/utils/flags.go
cmd/utils/flags.go
+13
-19
未找到文件。
cmd/geth/main.go
浏览文件 @
d648e96b
...
...
@@ -464,9 +464,12 @@ func execScripts(ctx *cli.Context) {
node
.
Stop
()
}
// tries unlocking the specified account a few times.
func
unlockAccount
(
ctx
*
cli
.
Context
,
accman
*
accounts
.
Manager
,
address
string
,
i
int
,
passwords
[]
string
)
(
common
.
Address
,
string
)
{
// Try to unlock the specified account a few times
account
:=
utils
.
MakeAddress
(
accman
,
address
)
account
,
err
:=
utils
.
MakeAddress
(
accman
,
address
)
if
err
!=
nil
{
utils
.
Fatalf
(
"Unlock error: %v"
,
err
)
}
for
trials
:=
0
;
trials
<
3
;
trials
++
{
prompt
:=
fmt
.
Sprintf
(
"Unlocking account %s | Attempt %d/%d"
,
address
,
trials
+
1
,
3
)
...
...
cmd/utils/flags.go
浏览文件 @
d648e96b
...
...
@@ -518,47 +518,41 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
// MakeAddress converts an account specified directly as a hex encoded string or
// a key index in the key store to an internal account representation.
func
MakeAddress
(
accman
*
accounts
.
Manager
,
account
string
)
common
.
Address
{
func
MakeAddress
(
accman
*
accounts
.
Manager
,
account
string
)
(
a
common
.
Address
,
err
error
)
{
// If the specified account is a valid address, return it
if
common
.
IsHexAddress
(
account
)
{
return
common
.
HexToAddress
(
account
)
return
common
.
HexToAddress
(
account
)
,
nil
}
// Otherwise try to interpret the account as a keystore index
index
,
err
:=
strconv
.
Atoi
(
account
)
if
err
!=
nil
{
Fatalf
(
"Invalid account address or index: '%s'
"
,
account
)
return
a
,
fmt
.
Errorf
(
"invalid account address or index %q
"
,
account
)
}
hex
,
err
:=
accman
.
AddressByIndex
(
index
)
if
err
!=
nil
{
Fatalf
(
"Failed to retrieve requested account #%d: %v
"
,
index
,
err
)
return
a
,
fmt
.
Errorf
(
"can't get account #%d (%v)
"
,
index
,
err
)
}
return
common
.
HexToAddress
(
hex
)
return
common
.
HexToAddress
(
hex
)
,
nil
}
// MakeEtherbase retrieves the etherbase either from the directly specified
// command line flags or from the keystore if CLI indexed.
func
MakeEtherbase
(
accman
*
accounts
.
Manager
,
ctx
*
cli
.
Context
)
common
.
Address
{
// If the specified etherbase is a valid address, return it
etherbase
:=
ctx
.
GlobalString
(
EtherbaseFlag
.
Name
)
if
common
.
IsHexAddress
(
etherbase
)
{
return
common
.
HexToAddress
(
etherbase
)
}
// If no etherbase was specified and no accounts are known, bail out
accounts
,
_
:=
accman
.
Accounts
()
if
etherbase
==
""
&&
len
(
accounts
)
==
0
{
if
!
ctx
.
GlobalIsSet
(
EtherbaseFlag
.
Name
)
&&
len
(
accounts
)
==
0
{
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"WARNING: No etherbase set and no accounts found as default"
)
return
common
.
Address
{}
}
// Otherwise try to interpret the parameter as a keystore index
index
,
err
:=
strconv
.
Atoi
(
etherbase
)
if
err
!=
nil
{
Fatalf
(
"Invalid account address or index: '%s'"
,
etherbase
)
etherbase
:=
ctx
.
GlobalString
(
EtherbaseFlag
.
Name
)
if
etherbase
==
""
{
return
common
.
Address
{}
}
hex
,
err
:=
accman
.
AddressByIndex
(
index
)
// If the specified etherbase is a valid address, return it
addr
,
err
:=
MakeAddress
(
accman
,
etherbase
)
if
err
!=
nil
{
Fatalf
(
"
Failed to set requested account #%d as etherbase: %v"
,
index
,
err
)
Fatalf
(
"
Option %q: %v"
,
EtherbaseFlag
.
Name
,
err
)
}
return
common
.
HexToAddress
(
hex
)
return
addr
}
// MakeMinerExtra resolves extradata for the miner from the set command line flags
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录