aboutsummaryrefslogtreecommitdiffstats
path: root/ethminer/miner.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2014-10-29 10:50:20 +0800
committerFelix Lange <fjl@twurst.com>2014-10-29 10:50:20 +0800
commit6b3f5fb82b0304f477a1c36b68b0d07232405aff (patch)
treea0d52b610b2876fcbcce8bb00e84ba81799d568d /ethminer/miner.go
parent5920aa7be6fb973c7cbae34c9d4af03665933c51 (diff)
downloadgo-tangerine-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar
go-tangerine-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.gz
go-tangerine-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.bz2
go-tangerine-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.lz
go-tangerine-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.xz
go-tangerine-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.zst
go-tangerine-6b3f5fb82b0304f477a1c36b68b0d07232405aff.zip
cmd/mist, ethchain, ethminer: split TxEvent (#165)
Diffstat (limited to 'ethminer/miner.go')
-rw-r--r--ethminer/miner.go28
1 files changed, 13 insertions, 15 deletions
diff --git a/ethminer/miner.go b/ethminer/miner.go
index e0bef078b..43a6f302d 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())
@@ -125,23 +125,21 @@ func (miner *Miner) listener() {
}
}
- 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
}
}
+ if found == false {
+ // Undo all previous commits
+ miner.block.Undo()
+ // Apply new transactions
+ miner.txs = append(miner.txs, event.Tx)
+ }
}
case <-miner.powDone: