From fc9ca96104da7a030b9e48b8ff4c0d11459564f9 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Sat, 15 Nov 2025 01:07:20 +0800 Subject: [PATCH] core/types, miner: remove unused parameter `signers` for `NewTransactionsByPriceAndNonce()` (#1732) --- core/types/transaction.go | 11 +---------- core/types/transaction_test.go | 4 ++-- miner/worker.go | 5 ++--- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index 2d697548ad..acea3a989e 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -710,7 +710,7 @@ type TransactionsByPriceAndNonce struct { // if after providing it to the constructor. // // It also classifies special txs and normal txs -func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transactions, signers map[common.Address]struct{}, payersSwap map[common.Address]*big.Int) (*TransactionsByPriceAndNonce, Transactions) { +func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transactions, payersSwap map[common.Address]*big.Int) (*TransactionsByPriceAndNonce, Transactions) { // Initialize a price and received time based heap with the head transactions heads := TxByPriceAndTime{} heads.payersSwap = payersSwap @@ -719,15 +719,6 @@ func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transa from, _ := Sender(signer, accTxs[0]) var normalTxs Transactions lastSpecialTx := -1 - if len(signers) > 0 { - if _, ok := signers[from]; ok { - for i, tx := range accTxs { - if tx.IsSpecialTransaction() { - lastSpecialTx = i - } - } - } - } if lastSpecialTx >= 0 { for i := 0; i <= lastSpecialTx; i++ { specialTxs = append(specialTxs, accTxs[i]) diff --git a/core/types/transaction_test.go b/core/types/transaction_test.go index e0d46bd8d6..99d90fc03d 100644 --- a/core/types/transaction_test.go +++ b/core/types/transaction_test.go @@ -281,7 +281,7 @@ func TestTransactionPriceNonceSort(t *testing.T) { } } // Sort the transactions and cross check the nonce ordering - txset, _ := NewTransactionsByPriceAndNonce(signer, groups, nil, map[common.Address]*big.Int{}) + txset, _ := NewTransactionsByPriceAndNonce(signer, groups, map[common.Address]*big.Int{}) txs := Transactions{} for tx := txset.Peek(); tx != nil; tx = txset.Peek() { @@ -392,7 +392,7 @@ func TestTransactionTimeSort(t *testing.T) { groups[addr] = append(groups[addr], tx) } // Sort the transactions and cross check the nonce ordering - txset, _ := NewTransactionsByPriceAndNonce(signer, groups, nil, map[common.Address]*big.Int{}) + txset, _ := NewTransactionsByPriceAndNonce(signer, groups, map[common.Address]*big.Int{}) txs := Transactions{} for tx := txset.Peek(); tx != nil; tx = txset.Peek() { diff --git a/miner/worker.go b/miner/worker.go index 137babf1e8..ff4b8aa38c 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -352,7 +352,7 @@ func (w *worker) update() { txs[acc] = append(txs[acc], tx) } feeCapacity := state.GetTRC21FeeCapacityFromState(w.current.state) - txset, specialTxs := types.NewTransactionsByPriceAndNonce(w.current.signer, txs, nil, feeCapacity) + txset, specialTxs := types.NewTransactionsByPriceAndNonce(w.current.signer, txs, feeCapacity) tcount := w.current.tcount w.current.commitTransactions(w.mux, feeCapacity, txset, specialTxs, w.chain, w.coinbase, &w.pendingLogsFeed) @@ -769,9 +769,8 @@ func (w *worker) commitNewWork() { log.Error("[commitNewWork] fail to check if block is epoch switch block when fetching pending transactions", "BlockNum", header.Number, "Hash", header.Hash()) } if !isEpochSwitchBlock { - var signers map[common.Address]struct{} pending := w.eth.TxPool().Pending(true) - txs, specialTxs = types.NewTransactionsByPriceAndNonce(w.current.signer, pending, signers, feeCapacity) + txs, specialTxs = types.NewTransactionsByPriceAndNonce(w.current.signer, pending, feeCapacity) } } if atomic.LoadInt32(&w.mining) == 1 {