()
| 157 | } |
| 158 | |
| 159 | func (e *engine) pending() (*types.Block, *state.StateDB) { |
| 160 | if atomic.LoadInt32(&e.mining) == 0 { |
| 161 | // return a snapshot to avoid contention on currentMu mutex |
| 162 | e.snapshotMu.RLock() |
| 163 | defer e.snapshotMu.RUnlock() |
| 164 | return e.snapshotBlock, e.snapshotState.Copy() |
| 165 | } |
| 166 | |
| 167 | e.currentMu.RLock() |
| 168 | defer e.currentMu.RUnlock() |
| 169 | return e.currentWork.Block, e.currentWork.pubState.Copy() |
| 170 | } |
| 171 | |
| 172 | func (e *engine) pendingBlock() *types.Block { |
| 173 | if atomic.LoadInt32(&e.mining) == 0 { |