diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-28 00:02:31 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-28 00:02:31 +0800 |
commit | 10782c5aae51a766ab583a9d563cb2ff8a64e89d (patch) | |
tree | 1ebe4388ec32051f7538e444dbd98a548abf5685 | |
parent | cbc67099379712cb037b4f2cdf1126f735948635 (diff) | |
download | go-tangerine-10782c5aae51a766ab583a9d563cb2ff8a64e89d.tar.gz go-tangerine-10782c5aae51a766ab583a9d563cb2ff8a64e89d.tar.zst go-tangerine-10782c5aae51a766ab583a9d563cb2ff8a64e89d.zip |
Added removal off erroneous txs. Fixed pipeline
-rw-r--r-- | ethminer/miner.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ethminer/miner.go b/ethminer/miner.go index 9fca9961a..e0bef078b 100644 --- a/ethminer/miner.go +++ b/ethminer/miner.go @@ -81,18 +81,19 @@ func (miner *Miner) Stop() { } func (miner *Miner) listener() { - for { - miner.startMining() + miner.startMining() + for { select { case event, isopen := <-miner.events.Chan(): - miner.stopMining() if !isopen { return } switch event := event.(type) { case ethchain.NewBlockEvent: + miner.stopMining() + block := event.Block //logger.Infoln("Got new block via Reactor") if bytes.Compare(miner.ethereum.ChainManager().CurrentBlock.Hash(), block.Hash()) == 0 { @@ -126,6 +127,8 @@ func (miner *Miner) listener() { case ethchain.TxEvent: if event.Type == ethchain.TxPre { + miner.stopMining() + found := false for _, ctx := range miner.txs { if found = bytes.Compare(ctx.Hash(), event.Tx.Hash()) == 0; found { @@ -142,7 +145,7 @@ func (miner *Miner) listener() { } case <-miner.powDone: - // next iteration will start mining again + miner.startMining() } } } @@ -178,10 +181,11 @@ func (self *Miner) mineNewBlock() { parent := self.ethereum.ChainManager().GetBlock(self.block.PrevHash) coinbase := self.block.State().GetOrNewStateObject(self.block.Coinbase) coinbase.SetGasPool(self.block.CalcGasLimit(parent)) - receipts, txs, unhandledTxs, err := stateManager.ProcessTransactions(coinbase, self.block.State(), self.block, self.block, self.txs) + receipts, txs, unhandledTxs, erroneous, err := stateManager.ProcessTransactions(coinbase, self.block.State(), self.block, self.block, self.txs) if err != nil { logger.Debugln(err) } + self.ethereum.TxPool().RemoveSet(erroneous) self.txs = append(txs, unhandledTxs...) self.block.SetTxHash(receipts) |