aboutsummaryrefslogtreecommitdiffstats
path: root/ethminer
diff options
context:
space:
mode:
Diffstat (limited to 'ethminer')
-rw-r--r--ethminer/miner.go28
1 files changed, 13 insertions, 15 deletions
diff --git a/ethminer/miner.go b/ethminer/miner.go
index 24af7fbcb..57cf0cd57 100644
--- a/ethminer/miner.go
+++ b/ethminer/miner.go
@@ -64,7 +64,7 @@ func (miner *Miner) Start() {
miner.block = miner.ethereum.ChainManager().NewBlock(miner.coinbase)
mux := miner.ethereum.EventMux()
- miner.events = mux.Subscribe(ethchain.NewBlockEvent{}, ethchain.TxEvent{})
+ miner.events = mux.Subscribe(ethchain.NewBlockEvent{}, ethchain.TxPreEvent{})
// Prepare inital block
//miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
@@ -118,25 +118,23 @@ func (miner *Miner) listener() {
}
miner.startMining()
- case ethchain.TxEvent:
- if event.Type == ethchain.TxPre {
- miner.stopMining()
+ case ethchain.TxPreEvent:
+ miner.stopMining()
- found := false
- for _, ctx := range miner.txs {
- if found = bytes.Compare(ctx.Hash(), event.Tx.Hash()) == 0; found {
- break
- }
- }
- if found == false {
- // Undo all previous commits
- miner.block.Undo()
- // Apply new transactions
- miner.txs = append(miner.txs, event.Tx)
+ found := false
+ for _, ctx := range miner.txs {
+ if found = bytes.Compare(ctx.Hash(), event.Tx.Hash()) == 0; found {
+ break
}
miner.startMining()
}
+ if found == false {
+ // Undo all previous commits
+ miner.block.Undo()
+ // Apply new transactions
+ miner.txs = append(miner.txs, event.Tx)
+ }
}
case <-miner.powDone: