aboutsummaryrefslogtreecommitdiffstats
path: root/ethminer
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
parent5920aa7be6fb973c7cbae34c9d4af03665933c51 (diff)
downloaddexon-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar
dexon-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.gz
dexon-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.bz2
dexon-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.lz
dexon-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.xz
dexon-6b3f5fb82b0304f477a1c36b68b0d07232405aff.tar.zst
dexon-6b3f5fb82b0304f477a1c36b68b0d07232405aff.zip
cmd/mist, ethchain, ethminer: split TxEvent (#165)
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 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: