@@ -457,9 +457,42 @@ func (self *worker) commitNewWork() {
457
457
self .makeCurrent (parent , header )
458
458
work := self .current
459
459
460
- // commit transactions for this run.
460
+ /* //approach 1
461
461
transactions := self.eth.TxPool().GetTransactions()
462
462
sort.Sort(types.TxByNonce{transactions})
463
+ */
464
+
465
+ //approach 2
466
+ transactions := self .eth .TxPool ().GetTransactions ()
467
+ sort .Sort (types.TxByPriceAndNonce {transactions })
468
+
469
+ /* // approach 3
470
+ // commit transactions for this run.
471
+ txPerOwner := make(map[common.Address]types.Transactions)
472
+ // Sort transactions by owner
473
+ for _, tx := range self.eth.TxPool().GetTransactions() {
474
+ from, _ := tx.From() // we can ignore the sender error
475
+ txPerOwner[from] = append(txPerOwner[from], tx)
476
+ }
477
+ var (
478
+ singleTxOwner types.Transactions
479
+ multiTxOwner types.Transactions
480
+ )
481
+ // Categorise transactions by
482
+ // 1. 1 owner tx per block
483
+ // 2. multi txs owner per block
484
+ for _, txs := range txPerOwner {
485
+ if len(txs) == 1 {
486
+ singleTxOwner = append(singleTxOwner, txs[0])
487
+ } else {
488
+ multiTxOwner = append(multiTxOwner, txs...)
489
+ }
490
+ }
491
+ sort.Sort(types.TxByPrice{singleTxOwner})
492
+ sort.Sort(types.TxByNonce{multiTxOwner})
493
+ transactions := append(singleTxOwner, multiTxOwner...)
494
+ */
495
+
463
496
work .coinbase .SetGasLimit (header .GasLimit )
464
497
work .commitTransactions (transactions , self .gasPrice , self .proc )
465
498
self .eth .TxPool ().RemoveTransactions (work .lowGasTxs )
0 commit comments