aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethtest/main.go10
-rw-r--r--cmd/geth/main.go4
-rw-r--r--cmd/utils/cmd.go17
-rw-r--r--cmd/utils/flags.go12
4 files changed, 41 insertions, 2 deletions
diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go
index 1ae77f88f..5429cab31 100644
--- a/cmd/ethtest/main.go
+++ b/cmd/ethtest/main.go
@@ -36,6 +36,7 @@ var (
defaultTest = "all"
defaultDir = "."
allTests = []string{"BlockTests", "StateTests", "TransactionTests", "VMTests", "RLPTests"}
+ testDirMapping = map[string]string{"BlockTests": "BlockchainTests"}
skipTests = []string{}
TestFlag = cli.StringFlag{
@@ -135,8 +136,13 @@ func runSuite(test, file string) {
var err error
var files []string
if test == defaultTest {
- files, err = getFiles(filepath.Join(file, curTest))
-
+ // check if we have an explicit directory mapping for the test
+ if _, ok := testDirMapping[curTest]; ok {
+ files, err = getFiles(filepath.Join(file, testDirMapping[curTest]))
+ } else {
+ // otherwise assume test name
+ files, err = getFiles(filepath.Join(file, curTest))
+ }
} else {
files, err = getFiles(file)
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 68a2c79e2..511e0df9d 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -280,6 +280,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.BootnodesFlag,
utils.DataDirFlag,
utils.BlockchainVersionFlag,
+ utils.OlympicFlag,
utils.CacheFlag,
utils.JSpathFlag,
utils.ListenPortFlag,
@@ -346,6 +347,9 @@ func main() {
func run(ctx *cli.Context) {
utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
+ if ctx.GlobalBool(utils.OlympicFlag.Name) {
+ utils.InitOlympic()
+ }
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
ethereum, err := eth.New(cfg)
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index d9c4b6da5..f8f7f6376 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -21,6 +21,7 @@ import (
"bufio"
"fmt"
"io"
+ "math/big"
"os"
"os/signal"
"regexp"
@@ -32,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/peterh/liner"
)
@@ -143,6 +145,15 @@ func StartEthereum(ethereum *eth.Ethereum) {
}()
}
+func InitOlympic() {
+ params.DurationLimit = big.NewInt(8)
+ params.GenesisGasLimit = big.NewInt(3141592)
+ params.MinGasLimit = big.NewInt(125000)
+ params.MaximumExtraDataSize = big.NewInt(1024)
+ NetworkIdFlag.Value = 0
+ core.BlockReward = big.NewInt(1.5e+18)
+}
+
func FormatTransactionData(data string) []byte {
d := common.StringToByteFunc(data, func(s string) (ret []byte) {
slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000)
@@ -203,6 +214,11 @@ func ImportChain(chain *core.ChainManager, fn string) error {
} else if err != nil {
return fmt.Errorf("at block %d: %v", n, err)
}
+ // don't import first block
+ if b.NumberU64() == 0 {
+ i--
+ continue
+ }
blocks[i] = &b
n++
}
@@ -218,6 +234,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
batch, blocks[0].Hash().Bytes()[:4], blocks[i-1].Hash().Bytes()[:4])
continue
}
+
if _, err := chain.InsertChain(blocks[:i]); err != nil {
return fmt.Errorf("invalid block %d: %v", n, err)
}
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index b66fe24cc..d283329f1 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -131,6 +131,10 @@ var (
Usage: "Megabytes of memory allocated to internal caching",
Value: 0,
}
+ OlympicFlag = cli.BoolFlag{
+ Name: "olympic",
+ Usage: "Use olympic style protocol",
+ }
// miner settings
MinerThreadsFlag = cli.IntFlag{
@@ -402,6 +406,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
Port: ctx.GlobalString(ListenPortFlag.Name),
+ Olympic: ctx.GlobalBool(OlympicFlag.Name),
NAT: MakeNAT(ctx),
NatSpec: ctx.GlobalBool(NatspecEnabledFlag.Name),
Discovery: !ctx.GlobalBool(NoDiscoverFlag.Name),
@@ -444,6 +449,13 @@ func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, ex
if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "extra"), cache); err != nil {
Fatalf("Could not open database: %v", err)
}
+ if ctx.GlobalBool(OlympicFlag.Name) {
+ InitOlympic()
+ _, err := core.WriteTestNetGenesisBlock(stateDB, blockDB, 42)
+ if err != nil {
+ glog.Fatalln(err)
+ }
+ }
eventMux := new(event.TypeMux)
pow := ethash.New()