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
228a2970
Unverified
Commit
228a2970
authored
Apr 02, 2020
by
Martin Holst Swende
Committed by
GitHub
Apr 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth: fix bad genesis test (#20860)
parent
ad4b60ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
22 deletions
+6
-22
genesis_test.go
cmd/geth/genesis_test.go
+6
-22
No files found.
cmd/geth/genesis_test.go
View file @
228a2970
...
@@ -28,22 +28,6 @@ var customGenesisTests = []struct {
...
@@ -28,22 +28,6 @@ var customGenesisTests = []struct {
query
string
query
string
result
string
result
string
}{
}{
// Plain genesis file without anything extra
{
genesis
:
`{
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}`
,
query
:
"eth.getBlock(0).nonce"
,
result
:
"0x0000000000000042"
,
},
// Genesis file with an empty chain configuration (ensure missing fields work)
// Genesis file with an empty chain configuration (ensure missing fields work)
{
{
genesis
:
`{
genesis
:
`{
...
@@ -52,14 +36,14 @@ var customGenesisTests = []struct {
...
@@ -52,14 +36,14 @@ var customGenesisTests = []struct {
"difficulty" : "0x20000",
"difficulty" : "0x20000",
"extraData" : "",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"gasLimit" : "0x2fefd8",
"nonce" : "0x000000000000
0042
",
"nonce" : "0x000000000000
1338
",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00",
"timestamp" : "0x00",
"config" : {}
"config" : {}
}`
,
}`
,
query
:
"eth.getBlock(0).nonce"
,
query
:
"eth.getBlock(0).nonce"
,
result
:
"0x000000000000
0042
"
,
result
:
"0x000000000000
1338
"
,
},
},
// Genesis file with specific chain configurations
// Genesis file with specific chain configurations
{
{
...
@@ -69,7 +53,7 @@ var customGenesisTests = []struct {
...
@@ -69,7 +53,7 @@ var customGenesisTests = []struct {
"difficulty" : "0x20000",
"difficulty" : "0x20000",
"extraData" : "",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"gasLimit" : "0x2fefd8",
"nonce" : "0x000000000000
0042
",
"nonce" : "0x000000000000
1339
",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00",
"timestamp" : "0x00",
...
@@ -80,7 +64,7 @@ var customGenesisTests = []struct {
...
@@ -80,7 +64,7 @@ var customGenesisTests = []struct {
}
}
}`
,
}`
,
query
:
"eth.getBlock(0).nonce"
,
query
:
"eth.getBlock(0).nonce"
,
result
:
"0x000000000000
0042
"
,
result
:
"0x000000000000
1339
"
,
},
},
}
}
...
@@ -97,10 +81,10 @@ func TestCustomGenesis(t *testing.T) {
...
@@ -97,10 +81,10 @@ func TestCustomGenesis(t *testing.T) {
if
err
:=
ioutil
.
WriteFile
(
json
,
[]
byte
(
tt
.
genesis
),
0600
);
err
!=
nil
{
if
err
:=
ioutil
.
WriteFile
(
json
,
[]
byte
(
tt
.
genesis
),
0600
);
err
!=
nil
{
t
.
Fatalf
(
"test %d: failed to write genesis file: %v"
,
i
,
err
)
t
.
Fatalf
(
"test %d: failed to write genesis file: %v"
,
i
,
err
)
}
}
runGeth
(
t
,
"--datadir"
,
datadir
,
"init"
,
json
)
.
WaitExit
()
runGeth
(
t
,
"--
nousb"
,
"--
datadir"
,
datadir
,
"init"
,
json
)
.
WaitExit
()
// Query the custom genesis block
// Query the custom genesis block
geth
:=
runGeth
(
t
,
geth
:=
runGeth
(
t
,
"--nousb"
,
"--datadir"
,
datadir
,
"--maxpeers"
,
"0"
,
"--port"
,
"0"
,
"--datadir"
,
datadir
,
"--maxpeers"
,
"0"
,
"--port"
,
"0"
,
"--nodiscover"
,
"--nat"
,
"none"
,
"--ipcdisable"
,
"--nodiscover"
,
"--nat"
,
"none"
,
"--ipcdisable"
,
"--exec"
,
tt
.
query
,
"console"
)
"--exec"
,
tt
.
query
,
"console"
)
...
...
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