Merge pull request #2143 from karalabe/fix-transaction-sort-2

core, core/types, miner: fix transaction nonce-price combo sort
This commit is contained in:
Jeffrey Wilcke
2016-01-28 16:11:14 +01:00
4 changed files with 132 additions and 23 deletions

View File

@ -19,7 +19,6 @@ package miner
import (
"fmt"
"math/big"
"sort"
"sync"
"sync/atomic"
"time"
@ -496,12 +495,12 @@ func (self *worker) commitNewWork() {
/* //approach 1
transactions := self.eth.TxPool().GetTransactions()
sort.Sort(types.TxByNonce{transactions})
sort.Sort(types.TxByNonce(transactions))
*/
//approach 2
transactions := self.eth.TxPool().GetTransactions()
sort.Sort(types.TxByPriceAndNonce{transactions})
types.SortByPriceAndNonce(transactions)
/* // approach 3
// commit transactions for this run.
@ -525,8 +524,8 @@ func (self *worker) commitNewWork() {
multiTxOwner = append(multiTxOwner, txs...)
}
}
sort.Sort(types.TxByPrice{singleTxOwner})
sort.Sort(types.TxByNonce{multiTxOwner})
sort.Sort(types.TxByPrice(singleTxOwner))
sort.Sort(types.TxByNonce(multiTxOwner))
transactions := append(singleTxOwner, multiTxOwner...)
*/