aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-29 21:50:27 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-11-29 21:50:27 +0800
commit7267f796e673a11fae3b6eda4bea19a8331f6c75 (patch)
tree971e8b9337fb40ef36f8898f74b6224f660f8fc1 /cmd/geth
parent3807e520ec99dce5dc6ef28b237cd4be4a0992fe (diff)
downloaddexon-7267f796e673a11fae3b6eda4bea19a8331f6c75.tar
dexon-7267f796e673a11fae3b6eda4bea19a8331f6c75.tar.gz
dexon-7267f796e673a11fae3b6eda4bea19a8331f6c75.tar.bz2
dexon-7267f796e673a11fae3b6eda4bea19a8331f6c75.tar.lz
dexon-7267f796e673a11fae3b6eda4bea19a8331f6c75.tar.xz
dexon-7267f796e673a11fae3b6eda4bea19a8331f6c75.tar.zst
dexon-7267f796e673a11fae3b6eda4bea19a8331f6c75.zip
cmd: drop DAO related choice flags since ETC diverged
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/dao_test.go87
-rw-r--r--cmd/geth/main.go2
2 files changed, 17 insertions, 72 deletions
diff --git a/cmd/geth/dao_test.go b/cmd/geth/dao_test.go
index 06578b612..f9ce80218 100644
--- a/cmd/geth/dao_test.go
+++ b/cmd/geth/dao_test.go
@@ -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.votes, arg.expectBlock, arg.expectVote)
+ testDAOForkBlockNewChain(t, i, arg.testnet, arg.genesis, arg.expectBlock, arg.expectVote)
}
}
-func testDAOForkBlockNewChain(t *testing.T, testnet 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)
}
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index bcf9edbf0..4164d4383 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -140,8 +140,6 @@ participating.
utils.MaxPendingPeersFlag,
utils.EtherbaseFlag,
utils.GasPriceFlag,
- utils.SupportDAOFork,
- utils.OpposeDAOFork,
utils.MinerThreadsFlag,
utils.MiningEnabledFlag,
utils.AutoDAGFlag,