diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-09-18 23:15:59 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-09-18 23:48:31 +0800 |
commit | 47ca6904b326165e394859f15bd2c374f7351847 (patch) | |
tree | b94493ab89bddece7d5ddce8606ee438f7db6d11 /cmd/geth | |
parent | 075815e5ff98a1ba59be58f3081f222f5bb6da1f (diff) | |
download | go-tangerine-47ca6904b326165e394859f15bd2c374f7351847.tar.gz go-tangerine-47ca6904b326165e394859f15bd2c374f7351847.tar.zst go-tangerine-47ca6904b326165e394859f15bd2c374f7351847.zip |
tests: use lastblockhash field to validate reorgs and block headers
Diffstat (limited to 'cmd/geth')
-rw-r--r-- | cmd/geth/blocktestcmd.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cmd/geth/blocktestcmd.go b/cmd/geth/blocktestcmd.go index a667cfd60..d3257ca4d 100644 --- a/cmd/geth/blocktestcmd.go +++ b/cmd/geth/blocktestcmd.go @@ -111,25 +111,27 @@ func runOneBlockTest(ctx *cli.Context, test *tests.BlockTest) (*eth.Ethereum, er if err != nil { return nil, err } - // if err := ethereum.Start(); err != nil { - // return nil, err - // } // import the genesis block ethereum.ResetWithGenesisBlock(test.Genesis) // import pre accounts - statedb, err := test.InsertPreState(ethereum) + _, err = test.InsertPreState(ethereum) if err != nil { return ethereum, fmt.Errorf("InsertPreState: %v", err) } - if err := test.TryBlocksInsert(ethereum.ChainManager()); err != nil { + cm := ethereum.ChainManager() + + validBlocks, err := test.TryBlocksInsert(cm) + if err != nil { return ethereum, fmt.Errorf("Block Test load error: %v", err) } - if err := test.ValidatePostState(statedb); err != nil { + newDB := cm.State() + if err := test.ValidatePostState(newDB); err != nil { return ethereum, fmt.Errorf("post state validation failed: %v", err) } - return ethereum, nil + + return ethereum, test.ValidateImportedHeaders(cm, validBlocks) } |