From 79009ca074d77561c655b65254103b4070b74c69 Mon Sep 17 00:00:00 2001 From: zelig Date: Fri, 27 Jun 2014 15:56:45 +0100 Subject: transitional ethutil.ReadConfig fixes in ethchain tests (they still fail! FIXME :) --- ethchain/block_chain_test.go | 10 +++++++++- ethchain/state_object_test.go | 4 ++-- ethchain/state_test.go | 2 +- ethchain/vm_test.go | 2 +- ethutil/config.go | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ethchain/block_chain_test.go b/ethchain/block_chain_test.go index ecaf8ca89..bbc96c823 100644 --- a/ethchain/block_chain_test.go +++ b/ethchain/block_chain_test.go @@ -1,6 +1,7 @@ package ethchain import ( + "container/list" "fmt" "github.com/ethereum/eth-go/ethdb" "github.com/ethereum/eth-go/ethutil" @@ -30,6 +31,10 @@ func (s *TestManager) PeerCount() int { return 0 } +func (s *TestManager) Peers() *list.List { + return list.New() +} + func (s *TestManager) BlockChain() *BlockChain { return s.blockChain } @@ -50,7 +55,8 @@ func (tm *TestManager) Broadcast(msgType ethwire.MsgType, data []interface{}) { } func NewTestManager() *TestManager { - ethutil.ReadConfig(".ethtest", ethutil.LogStd, "") + + ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "", "ETH") db, err := ethdb.NewMemDatabase() if err != nil { @@ -71,12 +77,14 @@ func NewTestManager() *TestManager { return testManager } + func (tm *TestManager) AddFakeBlock(blk []byte) error { block := NewBlockFromBytes(blk) tm.Blocks = append(tm.Blocks, block) err := tm.StateManager().Process(block, false) return err } + func (tm *TestManager) CreateChain1() error { err := tm.AddFakeBlock([]byte{248, 246, 248, 242, 160, 58, 253, 98, 206, 198, 181, 152, 223, 201, 116, 197, 154, 111, 104, 54, 113, 249, 184, 246, 15, 226, 142, 187, 47, 138, 60, 201, 66, 226, 237, 29, 7, 160, 29, 204, 77, 232, 222, 199, 93, 122, 171, 133, 181, 103, 182, 204, 212, 26, 211, 18, 69, 27, 148, 138, 116, 19, 240, 161, 66, 253, 64, 212, 147, 71, 184, 65, 4, 103, 109, 19, 120, 219, 91, 248, 48, 204, 17, 28, 7, 146, 72, 203, 15, 207, 251, 31, 216, 138, 26, 59, 34, 238, 40, 114, 233, 1, 13, 207, 90, 71, 136, 124, 86, 196, 127, 10, 176, 193, 154, 165, 76, 155, 154, 59, 45, 34, 96, 183, 212, 99, 41, 27, 40, 119, 171, 231, 160, 114, 56, 218, 173, 160, 80, 218, 177, 253, 147, 35, 101, 59, 37, 87, 97, 193, 119, 21, 132, 111, 93, 53, 152, 203, 38, 134, 25, 104, 138, 236, 92, 27, 176, 89, 229, 176, 160, 29, 204, 77, 232, 222, 199, 93, 122, 171, 133, 181, 103, 182, 204, 212, 26, 211, 18, 69, 27, 148, 138, 116, 19, 240, 161, 66, 253, 64, 212, 147, 71, 131, 63, 240, 0, 132, 83, 48, 32, 251, 128, 160, 4, 10, 11, 225, 132, 86, 146, 227, 229, 137, 164, 245, 16, 139, 219, 12, 251, 178, 154, 168, 210, 18, 84, 40, 250, 41, 124, 92, 169, 242, 246, 180, 192, 192}) err = tm.AddFakeBlock([]byte{248, 246, 248, 242, 160, 222, 229, 152, 228, 200, 163, 244, 144, 120, 18, 203, 253, 195, 185, 105, 131, 163, 226, 116, 40, 140, 68, 249, 198, 221, 152, 121, 0, 124, 11, 180, 125, 160, 29, 204, 77, 232, 222, 199, 93, 122, 171, 133, 181, 103, 182, 204, 212, 26, 211, 18, 69, 27, 148, 138, 116, 19, 240, 161, 66, 253, 64, 212, 147, 71, 184, 65, 4, 103, 109, 19, 120, 219, 91, 248, 48, 204, 17, 28, 7, 146, 72, 203, 15, 207, 251, 31, 216, 138, 26, 59, 34, 238, 40, 114, 233, 1, 13, 207, 90, 71, 136, 124, 86, 196, 127, 10, 176, 193, 154, 165, 76, 155, 154, 59, 45, 34, 96, 183, 212, 99, 41, 27, 40, 119, 171, 231, 160, 114, 56, 218, 173, 160, 80, 218, 177, 253, 147, 35, 101, 59, 37, 87, 97, 193, 119, 21, 132, 111, 93, 53, 152, 203, 38, 134, 25, 104, 138, 236, 92, 27, 176, 89, 229, 176, 160, 29, 204, 77, 232, 222, 199, 93, 122, 171, 133, 181, 103, 182, 204, 212, 26, 211, 18, 69, 27, 148, 138, 116, 19, 240, 161, 66, 253, 64, 212, 147, 71, 131, 63, 224, 4, 132, 83, 48, 36, 250, 128, 160, 79, 58, 51, 246, 238, 249, 210, 253, 136, 83, 71, 134, 49, 114, 190, 189, 242, 78, 100, 238, 101, 84, 204, 176, 198, 25, 139, 151, 60, 84, 51, 126, 192, 192}) diff --git a/ethchain/state_object_test.go b/ethchain/state_object_test.go index 91ed7c0dd..2588100d0 100644 --- a/ethchain/state_object_test.go +++ b/ethchain/state_object_test.go @@ -9,7 +9,7 @@ import ( ) func TestSync(t *testing.T) { - ethutil.ReadConfig("", ethutil.LogStd, "") + ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "", "ETH") db, _ := ethdb.NewMemDatabase() state := NewState(ethutil.NewTrie(db, "")) @@ -28,7 +28,7 @@ func TestSync(t *testing.T) { } func TestObjectGet(t *testing.T) { - ethutil.ReadConfig("", ethutil.LogStd, "") + ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "", "ETH") db, _ := ethdb.NewMemDatabase() ethutil.Config.Db = db diff --git a/ethchain/state_test.go b/ethchain/state_test.go index 292129953..503bdddb4 100644 --- a/ethchain/state_test.go +++ b/ethchain/state_test.go @@ -7,7 +7,7 @@ import ( ) func TestSnapshot(t *testing.T) { - ethutil.ReadConfig("", ethutil.LogStd, "") + ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "", "ETH") db, _ := ethdb.NewMemDatabase() state := NewState(ethutil.NewTrie(db, "")) diff --git a/ethchain/vm_test.go b/ethchain/vm_test.go index 518a88766..c569d89ae 100644 --- a/ethchain/vm_test.go +++ b/ethchain/vm_test.go @@ -12,7 +12,7 @@ import ( ) func TestRun4(t *testing.T) { - ethutil.ReadConfig("", ethutil.LogStd, "") + ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "", "ETH") db, _ := ethdb.NewMemDatabase() state := NewState(ethutil.NewTrie(db, "")) diff --git a/ethutil/config.go b/ethutil/config.go index aa4ae9c3e..b253aa203 100644 --- a/ethutil/config.go +++ b/ethutil/config.go @@ -44,7 +44,7 @@ func ReadConfig(ConfigFile string, Datadir string, Identifier string, EnvPrefix } else { g.ParseAll() } - Config = &config{ExecPath: Datadir, Debug: true, Ver: "0.5.14", conf: g, Identifier: Identifier} + Config = &config{ExecPath: Datadir, Debug: true, Ver: "0.5.15", conf: g, Identifier: Identifier} Config.SetClientString("Ethereum(G)") } return Config -- cgit v1.2.3