diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-03-16 17:20:02 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-03-16 17:23:26 +0800 |
commit | 0228fb57cd58147ab2c3914520c7805e25a8a1c4 (patch) | |
tree | 1540b12d2aa49ed869b2bb4bde5bd5b4c44532a0 /eth | |
parent | 2855a93ede6e9437d05a82c2397d48744621db9b (diff) | |
download | go-tangerine-0228fb57cd58147ab2c3914520c7805e25a8a1c4.tar go-tangerine-0228fb57cd58147ab2c3914520c7805e25a8a1c4.tar.gz go-tangerine-0228fb57cd58147ab2c3914520c7805e25a8a1c4.tar.bz2 go-tangerine-0228fb57cd58147ab2c3914520c7805e25a8a1c4.tar.lz go-tangerine-0228fb57cd58147ab2c3914520c7805e25a8a1c4.tar.xz go-tangerine-0228fb57cd58147ab2c3914520c7805e25a8a1c4.tar.zst go-tangerine-0228fb57cd58147ab2c3914520c7805e25a8a1c4.zip |
eth, miner: fetch pending block/state in on go (data race)
Diffstat (limited to 'eth')
-rw-r--r-- | eth/api.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/eth/api.go b/eth/api.go index 487d24ae7..c16c3d142 100644 --- a/eth/api.go +++ b/eth/api.go @@ -56,7 +56,8 @@ const defaultGas = uint64(90000) func blockByNumber(m *miner.Miner, bc *core.BlockChain, blockNr rpc.BlockNumber) *types.Block { // Pending block is only known by the miner if blockNr == rpc.PendingBlockNumber { - return m.PendingBlock() + block, _ := m.Pending() + return block } // Otherwise resolve and return the block if blockNr == rpc.LatestBlockNumber { @@ -72,7 +73,8 @@ func blockByNumber(m *miner.Miner, bc *core.BlockChain, blockNr rpc.BlockNumber) func stateAndBlockByNumber(m *miner.Miner, bc *core.BlockChain, blockNr rpc.BlockNumber, chainDb ethdb.Database) (*state.StateDB, *types.Block, error) { // Pending state is only known by the miner if blockNr == rpc.PendingBlockNumber { - return m.PendingState(), m.PendingBlock(), nil + block, state := m.Pending() + return state, block, nil } // Otherwise resolve the block number and return its state block := blockByNumber(m, bc, blockNr) |