Skip to content

Commit 228a297

Browse files
authored
cmd/geth: fix bad genesis test (#20860)
1 parent ad4b60e commit 228a297

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

‎cmd/geth/genesis_test.go‎

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,6 @@ var customGenesisTests = []struct {
2828
query string
2929
result string
3030
}{
31-
// Plain genesis file without anything extra
32-
{
33-
genesis: `{
34-
"alloc" : {},
35-
"coinbase" : "0x0000000000000000000000000000000000000000",
36-
"difficulty" : "0x20000",
37-
"extraData" : "",
38-
"gasLimit" : "0x2fefd8",
39-
"nonce" : "0x0000000000000042",
40-
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
41-
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
42-
"timestamp" : "0x00"
43-
}`,
44-
query: "eth.getBlock(0).nonce",
45-
result: "0x0000000000000042",
46-
},
4731
// Genesis file with an empty chain configuration (ensure missing fields work)
4832
{
4933
genesis: `{
@@ -52,14 +36,14 @@ var customGenesisTests = []struct {
5236
"difficulty" : "0x20000",
5337
"extraData" : "",
5438
"gasLimit" : "0x2fefd8",
55-
"nonce" : "0x0000000000000042",
39+
"nonce" : "0x0000000000001338",
5640
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
5741
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
5842
"timestamp" : "0x00",
5943
"config" : {}
6044
}`,
6145
query: "eth.getBlock(0).nonce",
62-
result: "0x0000000000000042",
46+
result: "0x0000000000001338",
6347
},
6448
// Genesis file with specific chain configurations
6549
{
@@ -69,7 +53,7 @@ var customGenesisTests = []struct {
6953
"difficulty" : "0x20000",
7054
"extraData" : "",
7155
"gasLimit" : "0x2fefd8",
72-
"nonce" : "0x0000000000000042",
56+
"nonce" : "0x0000000000001339",
7357
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
7458
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
7559
"timestamp" : "0x00",
@@ -80,7 +64,7 @@ var customGenesisTests = []struct {
8064
}
8165
}`,
8266
query: "eth.getBlock(0).nonce",
83-
result: "0x0000000000000042",
67+
result: "0x0000000000001339",
8468
},
8569
}
8670

@@ -97,10 +81,10 @@ func TestCustomGenesis(t *testing.T) {
9781
if err := ioutil.WriteFile(json, []byte(tt.genesis), 0600); err != nil {
9882
t.Fatalf("test %d: failed to write genesis file: %v", i, err)
9983
}
100-
runGeth(t, "--datadir", datadir, "init", json).WaitExit()
84+
runGeth(t, "--nousb", "--datadir", datadir, "init", json).WaitExit()
10185

10286
// Query the custom genesis block
103-
geth := runGeth(t,
87+
geth := runGeth(t, "--nousb",
10488
"--datadir", datadir, "--maxpeers", "0", "--port", "0",
10589
"--nodiscover", "--nat", "none", "--ipcdisable",
10690
"--exec", tt.query, "console")

0 commit comments

Comments
 (0)