Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
fc9939c4
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,发现更多精彩内容 >>
提交
fc9939c4
编写于
11月 29, 2016
作者:
P
Péter Szilágyi
提交者:
GitHub
11月 29, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3376 from karalabe/drop-dao-flags
cmd: drop DAO related choice flags since ETC diverged
上级
3807e520
7267f796
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
17 addition
and
88 deletion
+17
-88
cmd/geth/dao_test.go
cmd/geth/dao_test.go
+17
-70
cmd/geth/main.go
cmd/geth/main.go
+0
-2
cmd/utils/flags.go
cmd/utils/flags.go
+0
-16
未找到文件。
cmd/geth/dao_test.go
浏览文件 @
fc9939c4
...
...
@@ -83,75 +83,28 @@ var daoGenesisForkBlock = big.NewInt(314)
// TestDAOForkBlockNewChain tests that the DAO hard-fork number and the nodes support/opposition is correctly
// set in the database after various initialization procedures and invocations.
func
TestDAOForkBlockNewChain
(
t
*
testing
.
T
)
{
for
_
,
arg
:=
range
[]
struct
{
for
i
,
arg
:=
range
[]
struct
{
testnet
bool
genesis
string
votes
[][
2
]
bool
expectBlock
*
big
.
Int
expectVote
bool
}{
// Test DAO Default Mainnet
{
false
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
MainNetDAOForkBlock
,
true
},
// test DAO Support Mainnet
{
false
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
},
// test DAO Oppose Mainnet
{
false
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
},
// test DAO Switch To Support Mainnet
{
false
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
},
// test DAO Switch To Oppose Mainnet
{
false
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
},
{
false
,
""
,
params
.
MainNetDAOForkBlock
,
true
},
// test DAO Default Testnet
{
true
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
TestNetDAOForkBlock
,
true
},
// test DAO Support Testnet
{
true
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
},
// test DAO Oppose Testnet
{
true
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
},
// test DAO Switch To Support Testnet
{
true
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
},
// test DAO Switch To Oppose Testnet
{
true
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
},
{
true
,
""
,
params
.
TestNetDAOForkBlock
,
true
},
// test DAO Init Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{},
nil
,
false
},
// test DAO Default Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
false
}},
nil
,
false
},
// test DAO Support Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
}},
nil
,
true
},
// test DAO Oppose Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
}},
nil
,
false
},
// test DAO Switch To Support Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
nil
,
true
},
// test DAO Switch To Oppose Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
nil
,
false
},
// test DAO Init No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
false
},
{
false
,
daoOldGenesis
,
nil
,
false
},
// test DAO Default No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
false
},
// test DAO Support No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Oppose No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
},
// test DAO Switch To Support No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Switch To Oppose No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
},
// test DAO Init Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
true
},
{
false
,
daoNoForkGenesis
,
daoGenesisForkBlock
,
false
},
// test DAO Default Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Support Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Oppose Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
},
// test DAO Switch To Support Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Switch To Oppose Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
},
{
false
,
daoProForkGenesis
,
daoGenesisForkBlock
,
true
},
}
{
testDAOForkBlockNewChain
(
t
,
arg
.
testnet
,
arg
.
genesis
,
arg
.
vote
s
,
arg
.
expectBlock
,
arg
.
expectVote
)
testDAOForkBlockNewChain
(
t
,
i
,
arg
.
testnet
,
arg
.
genesi
s
,
arg
.
expectBlock
,
arg
.
expectVote
)
}
}
func
testDAOForkBlockNewChain
(
t
*
testing
.
T
,
test
net
bool
,
genesis
string
,
votes
[][
2
]
bool
,
expectBlock
*
big
.
Int
,
expectVote
bool
)
{
func
testDAOForkBlockNewChain
(
t
*
testing
.
T
,
test
int
,
testnet
bool
,
genesis
string
,
expectBlock
*
big
.
Int
,
expectVote
bool
)
{
// Create a temporary data directory to use and inspect later
datadir
:=
tmpdir
(
t
)
defer
os
.
RemoveAll
(
datadir
)
...
...
@@ -160,21 +113,15 @@ func testDAOForkBlockNewChain(t *testing.T, testnet bool, genesis string, votes
if
genesis
!=
""
{
json
:=
filepath
.
Join
(
datadir
,
"genesis.json"
)
if
err
:=
ioutil
.
WriteFile
(
json
,
[]
byte
(
genesis
),
0600
);
err
!=
nil
{
t
.
Fatalf
(
"
failed to write genesis file: %v"
,
err
)
t
.
Fatalf
(
"
test %d: failed to write genesis file: %v"
,
test
,
err
)
}
runGeth
(
t
,
"--datadir"
,
datadir
,
"init"
,
json
)
.
cmd
.
Wait
()
}
for
_
,
vote
:=
range
votes
{
}
else
{
// Force chain initialization
args
:=
[]
string
{
"--port"
,
"0"
,
"--maxpeers"
,
"0"
,
"--nodiscover"
,
"--nat"
,
"none"
,
"--ipcdisable"
,
"--datadir"
,
datadir
}
if
testnet
{
args
=
append
(
args
,
"--testnet"
)
}
if
vote
[
0
]
{
args
=
append
(
args
,
"--support-dao-fork"
)
}
if
vote
[
1
]
{
args
=
append
(
args
,
"--oppose-dao-fork"
)
}
geth
:=
runGeth
(
t
,
append
(
args
,
[]
string
{
"--exec"
,
"2+2"
,
"console"
}
...
)
...
)
geth
.
cmd
.
Wait
()
}
...
...
@@ -185,7 +132,7 @@ func testDAOForkBlockNewChain(t *testing.T, testnet bool, genesis string, votes
}
db
,
err
:=
ethdb
.
NewLDBDatabase
(
path
,
0
,
0
)
if
err
!=
nil
{
t
.
Fatalf
(
"
failed to open test database: %v"
,
err
)
t
.
Fatalf
(
"
test %d: failed to open test database: %v"
,
test
,
err
)
}
defer
db
.
Close
()
...
...
@@ -198,20 +145,20 @@ func testDAOForkBlockNewChain(t *testing.T, testnet bool, genesis string, votes
}
config
,
err
:=
core
.
GetChainConfig
(
db
,
genesisHash
)
if
err
!=
nil
{
t
.
Errorf
(
"
failed to retrieve chain config: %v"
,
err
)
t
.
Errorf
(
"
test %d: failed to retrieve chain config: %v"
,
test
,
err
)
return
// we want to return here, the other checks can't make it past this point (nil panic).
}
// Validate the DAO hard-fork block number against the expected value
if
config
.
DAOForkBlock
==
nil
{
if
expectBlock
!=
nil
{
t
.
Errorf
(
"
dao hard-fork block mismatch: have nil, want %v"
,
expectBlock
)
t
.
Errorf
(
"
test %d: dao hard-fork block mismatch: have nil, want %v"
,
test
,
expectBlock
)
}
}
else
if
expectBlock
==
nil
{
t
.
Errorf
(
"
dao hard-fork block mismatch: have %v, want nil"
,
config
.
DAOForkBlock
)
t
.
Errorf
(
"
test %d: dao hard-fork block mismatch: have %v, want nil"
,
test
,
config
.
DAOForkBlock
)
}
else
if
config
.
DAOForkBlock
.
Cmp
(
expectBlock
)
!=
0
{
t
.
Errorf
(
"
dao hard-fork block mismatch: have %v, want %v"
,
config
.
DAOForkBlock
,
expectBlock
)
t
.
Errorf
(
"
test %d: dao hard-fork block mismatch: have %v, want %v"
,
test
,
config
.
DAOForkBlock
,
expectBlock
)
}
if
config
.
DAOForkSupport
!=
expectVote
{
t
.
Errorf
(
"
dao hard-fork support mismatch: have %v, want %v"
,
config
.
DAOForkSupport
,
expectVote
)
t
.
Errorf
(
"
test %d: dao hard-fork support mismatch: have %v, want %v"
,
test
,
config
.
DAOForkSupport
,
expectVote
)
}
}
cmd/geth/main.go
浏览文件 @
fc9939c4
...
...
@@ -140,8 +140,6 @@ participating.
utils
.
MaxPendingPeersFlag
,
utils
.
EtherbaseFlag
,
utils
.
GasPriceFlag
,
utils
.
SupportDAOFork
,
utils
.
OpposeDAOFork
,
utils
.
MinerThreadsFlag
,
utils
.
MiningEnabledFlag
,
utils
.
AutoDAGFlag
,
...
...
cmd/utils/flags.go
浏览文件 @
fc9939c4
...
...
@@ -177,15 +177,6 @@ var (
Usage
:
"Number of trie node generations to keep in memory"
,
Value
:
int
(
state
.
MaxTrieCacheGen
),
}
// Fork settings
SupportDAOFork
=
cli
.
BoolFlag
{
Name
:
"support-dao-fork"
,
Usage
:
"Updates the chain rules to support the DAO hard-fork"
,
}
OpposeDAOFork
=
cli
.
BoolFlag
{
Name
:
"oppose-dao-fork"
,
Usage
:
"Updates the chain rules to oppose the DAO hard-fork"
,
}
// Miner settings
MiningEnabledFlag
=
cli
.
BoolFlag
{
Name
:
"mine"
,
...
...
@@ -901,13 +892,6 @@ func MakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainCon
config
.
ChainId
=
params
.
MainNetChainID
}
}
// Force override any existing configs if explicitly requested
switch
{
case
ctx
.
GlobalBool
(
SupportDAOFork
.
Name
)
:
config
.
DAOForkSupport
=
true
case
ctx
.
GlobalBool
(
OpposeDAOFork
.
Name
)
:
config
.
DAOForkSupport
=
false
}
return
config
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录