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
5b31794d
Commit
5b31794d
authored
Nov 09, 2016
by
xiekeyang
Committed by
Felix Lange
Nov 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth: use a loop in TestDAOForkBlockNewChain (#3222)
parent
355f4b0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
84 deletions
+68
-84
dao_test.go
cmd/geth/dao_test.go
+68
-84
No files found.
cmd/geth/dao_test.go
View file @
5b31794d
...
...
@@ -80,91 +80,75 @@ var daoProForkGenesis = `{
var
daoGenesisHash
=
common
.
HexToHash
(
"5e1fc79cb4ffa4739177b5408045cd5d51c6cf766133f23f7cd72ee1f8d790e0"
)
var
daoGenesisForkBlock
=
big
.
NewInt
(
314
)
// Tests that the DAO hard-fork number and the nodes support/opposition is correctly
// Test
DAOForkBlockNewChain test
s that the DAO hard-fork number and the nodes support/opposition is correctly
// set in the database after various initialization procedures and invocations.
func
TestDAODefaultMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
MainNetDAOForkBlock
,
true
)
}
func
TestDAOSupportMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
)
}
func
TestDAOOpposeMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
)
}
func
TestDAOSwitchToSupportMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
)
}
func
TestDAODefaultTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
TestNetDAOForkBlock
,
true
)
}
func
TestDAOSupportTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
)
}
func
TestDAOOpposeTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
)
}
func
TestDAOSwitchToSupportTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
)
}
func
TestDAOInitOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{},
nil
,
false
)
}
func
TestDAODefaultOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
false
}},
nil
,
false
)
}
func
TestDAOSupportOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
}},
nil
,
true
)
}
func
TestDAOOpposeOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
}},
nil
,
false
)
}
func
TestDAOSwitchToSupportOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
nil
,
true
)
}
func
TestDAOSwitchToOpposeOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
nil
,
false
)
}
func
TestDAOInitNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
false
)
}
func
TestDAODefaultNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOSupportNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOOpposeNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOSwitchToSupportNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOInitProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
true
)
}
func
TestDAODefaultProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOSupportProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOOpposeProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOSwitchToSupportProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
)
func
TestDAOForkBlockNewChain
(
t
*
testing
.
T
)
{
for
_
,
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
},
// 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
},
// 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
},
// 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
},
// 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
},
}
{
testDAOForkBlockNewChain
(
t
,
arg
.
testnet
,
arg
.
genesis
,
arg
.
votes
,
arg
.
expectBlock
,
arg
.
expectVote
)
}
}
func
testDAOForkBlockNewChain
(
t
*
testing
.
T
,
testnet
bool
,
genesis
string
,
votes
[][
2
]
bool
,
expectBlock
*
big
.
Int
,
expectVote
bool
)
{
...
...
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