aboutsummaryrefslogtreecommitdiffstats
path: root/tests/block_test_util.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-10-16 06:26:47 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-10-16 06:26:47 +0800
commit60827dc50fc0892f63fc79704c57b45cf34f991e (patch)
tree351d66c284989acde5f368f1e5f29890ce96894b /tests/block_test_util.go
parent2e98631c5e5724bea1a29b877929b4911bf50b86 (diff)
downloaddexon-60827dc50fc0892f63fc79704c57b45cf34f991e.tar
dexon-60827dc50fc0892f63fc79704c57b45cf34f991e.tar.gz
dexon-60827dc50fc0892f63fc79704c57b45cf34f991e.tar.bz2
dexon-60827dc50fc0892f63fc79704c57b45cf34f991e.tar.lz
dexon-60827dc50fc0892f63fc79704c57b45cf34f991e.tar.xz
dexon-60827dc50fc0892f63fc79704c57b45cf34f991e.tar.zst
dexon-60827dc50fc0892f63fc79704c57b45cf34f991e.zip
tests: update tests, implement no-pow blocks (#17902)
This commit updates our tests with the latest and greatest from ethereum/tests. It also contains implementation of NoProof for blockchain tests.
Diffstat (limited to 'tests/block_test_util.go')
-rw-r--r--tests/block_test_util.go23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/block_test_util.go b/tests/block_test_util.go
index 427a94958..12cba3244 100644
--- a/tests/block_test_util.go
+++ b/tests/block_test_util.go
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/math"
+ "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
@@ -48,12 +49,13 @@ func (t *BlockTest) UnmarshalJSON(in []byte) error {
}
type btJSON struct {
- Blocks []btBlock `json:"blocks"`
- Genesis btHeader `json:"genesisBlockHeader"`
- Pre core.GenesisAlloc `json:"pre"`
- Post core.GenesisAlloc `json:"postState"`
- BestBlock common.UnprefixedHash `json:"lastblockhash"`
- Network string `json:"network"`
+ Blocks []btBlock `json:"blocks"`
+ Genesis btHeader `json:"genesisBlockHeader"`
+ Pre core.GenesisAlloc `json:"pre"`
+ Post core.GenesisAlloc `json:"postState"`
+ BestBlock common.UnprefixedHash `json:"lastblockhash"`
+ Network string `json:"network"`
+ SealEngine string `json:"sealEngine"`
}
type btBlock struct {
@@ -110,8 +112,13 @@ func (t *BlockTest) Run() error {
if gblock.Root() != t.json.Genesis.StateRoot {
return fmt.Errorf("genesis block state root does not match test: computed=%x, test=%x", gblock.Root().Bytes()[:6], t.json.Genesis.StateRoot[:6])
}
-
- chain, err := core.NewBlockChain(db, nil, config, ethash.NewShared(), vm.Config{}, nil)
+ var engine consensus.Engine
+ if t.json.SealEngine == "NoProof" {
+ engine = ethash.NewFaker()
+ } else {
+ engine = ethash.NewShared()
+ }
+ chain, err := core.NewBlockChain(db, nil, config, engine, vm.Config{}, nil)
if err != nil {
return err
}