cmd, core, miner: add --txpool.locals and priority mining

This commit is contained in:
Péter Szilágyi
2018-08-21 20:30:06 +03:00
parent b2c644ffb5
commit e0d0e64ce2
5 changed files with 70 additions and 8 deletions

View File

@ -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)
}