diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-03-02 06:32:43 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-04-01 07:01:10 +0800 |
commit | f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c (patch) | |
tree | 02e31a0e31040980e30e3a835ff9eba73e419439 /core/block_validator_test.go | |
parent | 10d3466c934bd425a8c941270749a652a588527d (diff) | |
download | go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.gz go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.tar.zst go-tangerine-f0cbebb19f3137ee3ba0e66dadd1b5b9dbf98b1c.zip |
core: added basic chain configuration
Added chain configuration options and write out during genesis database
insertion. If no "config" was found, nothing is written to the database.
Configurations are written on a per genesis base. This means
that any chain (which is identified by it's genesis hash) can have their
own chain settings.
Diffstat (limited to 'core/block_validator_test.go')
-rw-r--r-- | core/block_validator_test.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/block_validator_test.go b/core/block_validator_test.go index 2c4a97b45..aa29717b1 100644 --- a/core/block_validator_test.go +++ b/core/block_validator_test.go @@ -27,15 +27,20 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/pow/ezp" ) +func testChainConfig() *ChainConfig { + return &ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock} +} + func proc() (Validator, *BlockChain) { db, _ := ethdb.NewMemDatabase() var mux event.TypeMux WriteTestNetGenesisBlock(db) - blockchain, err := NewBlockChain(db, thePow(), &mux) + blockchain, err := NewBlockChain(db, testChainConfig(), thePow(), &mux) if err != nil { fmt.Println(err) } @@ -49,13 +54,14 @@ func TestNumber(t *testing.T) { statedb, _ := state.New(chain.Genesis().Root(), chain.chainDb) header := makeHeader(chain.Genesis(), statedb) header.Number = big.NewInt(3) - err := ValidateHeader(pow, header, chain.Genesis().Header(), false, false) + cfg := testChainConfig() + err := ValidateHeader(cfg, pow, header, chain.Genesis().Header(), false, false) if err != BlockNumberErr { t.Errorf("expected block number error, got %q", err) } header = makeHeader(chain.Genesis(), statedb) - err = ValidateHeader(pow, header, chain.Genesis().Header(), false, false) + err = ValidateHeader(cfg, pow, header, chain.Genesis().Header(), false, false) if err == BlockNumberErr { t.Errorf("didn't expect block number error") } |