aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-06-27 23:28:34 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-09-02 19:12:03 +0800
commit795b70423eac7180ab85b735f64aae9d6a10449d (patch)
treeafa669325907e0c56c9898010fbbed3695497c9c /miner
parent49227f65ff5ae42d47dfb65eaf88d38790543b06 (diff)
downloadgo-tangerine-795b70423eac7180ab85b735f64aae9d6a10449d.tar
go-tangerine-795b70423eac7180ab85b735f64aae9d6a10449d.tar.gz
go-tangerine-795b70423eac7180ab85b735f64aae9d6a10449d.tar.bz2
go-tangerine-795b70423eac7180ab85b735f64aae9d6a10449d.tar.lz
go-tangerine-795b70423eac7180ab85b735f64aae9d6a10449d.tar.xz
go-tangerine-795b70423eac7180ab85b735f64aae9d6a10449d.tar.zst
go-tangerine-795b70423eac7180ab85b735f64aae9d6a10449d.zip
core, eth, miner: only retain 1 tx/nonce, remove bad ones
Diffstat (limited to 'miner')
-rw-r--r--miner/worker.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/miner/worker.go b/miner/worker.go
index 59406bf4e..f243fe799 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -68,12 +68,12 @@ type Work struct {
ancestors *set.Set // ancestor set (used for checking uncle parent validity)
family *set.Set // family set (used for checking uncle invalidity)
uncles *set.Set // uncle set
- remove *set.Set // tx which will be removed
tcount int // tx count in cycle
ignoredTransactors *set.Set
lowGasTransactors *set.Set
ownedAccounts *set.Set
lowGasTxs types.Transactions
+ failedTxs types.Transactions
localMinedBlocks *uint64RingBuffer // the most recent block numbers that were mined locally (used to check block inclusion)
Block *types.Block // the new block
@@ -383,7 +383,6 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error
accounts := self.eth.AccountManager().Accounts()
// Keep track of transactions which return errors so they can be removed
- work.remove = set.New()
work.tcount = 0
work.ignoredTransactors = set.New()
work.lowGasTransactors = set.New()
@@ -533,7 +532,9 @@ func (self *worker) commitNewWork() {
*/
work.commitTransactions(self.mux, transactions, self.gasPrice, self.chain)
+
self.eth.TxPool().RemoveTransactions(work.lowGasTxs)
+ self.eth.TxPool().RemoveTransactions(work.failedTxs)
// compute uncles for the new block.
var (
@@ -639,11 +640,10 @@ func (env *Work) commitTransactions(mux *event.TypeMux, transactions types.Trans
// ignore the transactor so no nonce errors will be thrown for this account
// next time the worker is run, they'll be picked up again.
env.ignoredTransactors.Add(from)
-
glog.V(logger.Detail).Infof("Gas limit reached for (%x) in this block. Continue to try smaller txs\n", from[:4])
- case err != nil:
- env.remove.Add(tx.Hash())
+ case err != nil:
+ env.failedTxs = append(env.failedTxs, tx)
if glog.V(logger.Detail) {
glog.Infof("TX (%x) failed, will be removed: %v\n", tx.Hash().Bytes()[:4], err)
}