aboutsummaryrefslogtreecommitdiffstats
path: root/miner/worker.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-05-18 16:45:52 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-05-18 17:08:24 +0800
commit49719e21bcd740c5890334f8c0ec8ac3777fb4c6 (patch)
tree81caf3f5e52d25597f16a21b61b4d91ee4e023b0 /miner/worker.go
parenta2e43d28d01ef9642c7f6992b78b86bd0696c847 (diff)
downloaddexon-49719e21bcd740c5890334f8c0ec8ac3777fb4c6.tar.gz
dexon-49719e21bcd740c5890334f8c0ec8ac3777fb4c6.tar.zst
dexon-49719e21bcd740c5890334f8c0ec8ac3777fb4c6.zip
core, eth: minor txpool event cleanups
Diffstat (limited to 'miner/worker.go')
-rw-r--r--miner/worker.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/miner/worker.go b/miner/worker.go
index 3d086d6ae..640e9032e 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -42,7 +42,7 @@ const (
resultQueueSize = 10
miningLogAtDepth = 5
- // txChanSize is the size of channel listening to TxsPreEvent.
+ // txChanSize is the size of channel listening to NewTxsEvent.
// The number is referenced from the size of tx pool.
txChanSize = 4096
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
@@ -71,7 +71,7 @@ type Work struct {
family *set.Set // family set (used for checking uncle invalidity)
uncles *set.Set // uncle set
tcount int // tx count in cycle
- gasPool *core.GasPool // available gas used to pack transaction.
+ gasPool *core.GasPool // available gas used to pack transactions
Block *types.Block // the new block
@@ -96,7 +96,7 @@ type worker struct {
// update loop
mux *event.TypeMux
- txsCh chan core.TxsPreEvent
+ txsCh chan core.NewTxsEvent
txsSub event.Subscription
chainHeadCh chan core.ChainHeadEvent
chainHeadSub event.Subscription
@@ -138,7 +138,7 @@ func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase com
engine: engine,
eth: eth,
mux: mux,
- txsCh: make(chan core.TxsPreEvent, txChanSize),
+ txsCh: make(chan core.NewTxsEvent, txChanSize),
chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize),
chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize),
chainDb: eth.ChainDb(),
@@ -150,8 +150,8 @@ func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase com
agents: make(map[Agent]struct{}),
unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth),
}
- // Subscribe TxsPreEvent for tx pool
- worker.txsSub = eth.TxPool().SubscribeTxPreEvent(worker.txsCh)
+ // Subscribe NewTxsEvent for tx pool
+ worker.txsSub = eth.TxPool().SubscribeNewTxsEvent(worker.txsCh)
// Subscribe events for blockchain
worker.chainHeadSub = eth.BlockChain().SubscribeChainHeadEvent(worker.chainHeadCh)
worker.chainSideSub = eth.BlockChain().SubscribeChainSideEvent(worker.chainSideCh)
@@ -259,7 +259,7 @@ func (self *worker) update() {
self.possibleUncles[ev.Block.Hash()] = ev.Block
self.uncleMu.Unlock()
- // Handle TxsPreEvent
+ // Handle NewTxsEvent
case ev := <-self.txsCh:
// Apply transactions to the pending state if we're not mining.
//
@@ -538,7 +538,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
for {
// If we don't have enough gas for any further transactions then we're done
if env.gasPool.Gas() < params.TxGas {
- log.Trace("Not enough gas for further transactions", "gp", env.gasPool)
+ log.Trace("Not enough gas for further transactions", "have", env.gasPool, "want", params.TxGas)
break
}
// Retrieve the next transaction and abort if all done