aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-08-22 01:30:06 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-22 14:43:57 +0800
commite0d0e64ce22111a2d5492fe6f6d6a0023477e51f (patch)
tree553f970ffc21ac1a43d49948920da989a74d74d9 /miner
parentb2c644ffb5c283a171ddf3889693673939917541 (diff)
downloaddexon-e0d0e64ce22111a2d5492fe6f6d6a0023477e51f.tar.gz
dexon-e0d0e64ce22111a2d5492fe6f6d6a0023477e51f.tar.zst
dexon-e0d0e64ce22111a2d5492fe6f6d6a0023477e51f.zip
cmd, core, miner: add --txpool.locals and priority mining
Diffstat (limited to 'miner')
-rw-r--r--miner/worker.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/miner/worker.go b/miner/worker.go
index c299ff9dc..8c3337ba4 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -877,11 +877,26 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool) {
w.updateSnapshot()
return
}
- txs := types.NewTransactionsByPriceAndNonce(w.current.signer, pending)
- if w.commitTransactions(txs, w.coinbase, interrupt) {
- return
+ // Split the pending transactions into locals and remotes
+ localTxs, remoteTxs := make(map[common.Address]types.Transactions), pending
+ for _, account := range w.eth.TxPool().Locals() {
+ if txs := remoteTxs[account]; len(txs) > 0 {
+ delete(remoteTxs, account)
+ localTxs[account] = txs
+ }
+ }
+ if len(localTxs) > 0 {
+ txs := types.NewTransactionsByPriceAndNonce(w.current.signer, localTxs)
+ if w.commitTransactions(txs, w.coinbase, interrupt) {
+ return
+ }
+ }
+ if len(remoteTxs) > 0 {
+ txs := types.NewTransactionsByPriceAndNonce(w.current.signer, remoteTxs)
+ if w.commitTransactions(txs, w.coinbase, interrupt) {
+ return
+ }
}
-
w.commit(uncles, w.fullTaskHook, true, tstart)
}