diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-16 21:18:41 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-16 21:18:41 +0800 |
commit | b74775400906cc582bdbb98bf5067c5258ee491f (patch) | |
tree | fefd9cfe28ce5b409d58c70b03cf4a6d6dc84873 /eth | |
parent | f466243417f60531998e8b500f2bb043af5b3d2a (diff) | |
parent | 1b1f293082044c43d8d1c5df9ac40aab8fdb2ae8 (diff) | |
download | dexon-b74775400906cc582bdbb98bf5067c5258ee491f.tar dexon-b74775400906cc582bdbb98bf5067c5258ee491f.tar.gz dexon-b74775400906cc582bdbb98bf5067c5258ee491f.tar.bz2 dexon-b74775400906cc582bdbb98bf5067c5258ee491f.tar.lz dexon-b74775400906cc582bdbb98bf5067c5258ee491f.tar.xz dexon-b74775400906cc582bdbb98bf5067c5258ee491f.tar.zst dexon-b74775400906cc582bdbb98bf5067c5258ee491f.zip |
Merge pull request #1881 from Gustav-Simonsson/state_new_error
core/state, core, miner: handle missing root error from state.New
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 3 | ||||
-rw-r--r-- | eth/handler_test.go | 5 | ||||
-rw-r--r-- | eth/helper_test.go | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/eth/backend.go b/eth/backend.go index 83eefca5b..18900c91e 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -389,7 +389,8 @@ func New(config *Config) (*Ethereum, error) { return nil, err } - eth.txPool = core.NewTxPool(eth.EventMux(), eth.blockchain.State, eth.blockchain.GasLimit) + newPool := core.NewTxPool(eth.EventMux(), eth.blockchain.State, eth.blockchain.GasLimit) + eth.txPool = newPool eth.blockProcessor = core.NewBlockProcessor(chainDb, eth.pow, eth.blockchain, eth.EventMux()) eth.blockchain.SetProcessor(eth.blockProcessor) diff --git a/eth/handler_test.go b/eth/handler_test.go index 2b8c6168a..dde2ecbd5 100644 --- a/eth/handler_test.go +++ b/eth/handler_test.go @@ -443,10 +443,11 @@ func testGetNodeData(t *testing.T, protocol int) { } accounts := []common.Address{testBankAddress, acc1Addr, acc2Addr} for i := uint64(0); i <= pm.blockchain.CurrentBlock().NumberU64(); i++ { - trie := state.New(pm.blockchain.GetBlockByNumber(i).Root(), statedb) + trie, _ := state.New(pm.blockchain.GetBlockByNumber(i).Root(), statedb) for j, acc := range accounts { - bw := pm.blockchain.State().GetBalance(acc) + state, _ := pm.blockchain.State() + bw := state.GetBalance(acc) bh := trie.GetBalance(acc) if (bw != nil && bh == nil) || (bw == nil && bh != nil) { diff --git a/eth/helper_test.go b/eth/helper_test.go index e42fa1f82..9314884ef 100644 --- a/eth/helper_test.go +++ b/eth/helper_test.go @@ -38,7 +38,8 @@ func newTestProtocolManager(blocks int, generator func(int, *core.BlockGen), new blockproc = core.NewBlockProcessor(db, pow, blockchain, evmux) ) blockchain.SetProcessor(blockproc) - if _, err := blockchain.InsertChain(core.GenerateChain(genesis, db, blocks, generator)); err != nil { + chain := core.GenerateChain(genesis, db, blocks, generator) + if _, err := blockchain.InsertChain(chain); err != nil { panic(err) } pm := NewProtocolManager(NetworkId, evmux, &testTxPool{added: newtx}, pow, blockchain, db) |