core/types, miner: remove unused parameter signers for NewTransactionsByPriceAndNonce() (#1732)

This commit is contained in:
Daniel Liu 2025-11-15 01:07:20 +08:00 committed by GitHub
parent 8cbbc1e83d
commit fc9ca96104
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 15 deletions

View file

@ -710,7 +710,7 @@ type TransactionsByPriceAndNonce struct {
// if after providing it to the constructor. // if after providing it to the constructor.
// //
// It also classifies special txs and normal txs // 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 // Initialize a price and received time based heap with the head transactions
heads := TxByPriceAndTime{} heads := TxByPriceAndTime{}
heads.payersSwap = payersSwap heads.payersSwap = payersSwap
@ -719,15 +719,6 @@ func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transa
from, _ := Sender(signer, accTxs[0]) from, _ := Sender(signer, accTxs[0])
var normalTxs Transactions var normalTxs Transactions
lastSpecialTx := -1 lastSpecialTx := -1
if len(signers) > 0 {
if _, ok := signers[from]; ok {
for i, tx := range accTxs {
if tx.IsSpecialTransaction() {
lastSpecialTx = i
}
}
}
}
if lastSpecialTx >= 0 { if lastSpecialTx >= 0 {
for i := 0; i <= lastSpecialTx; i++ { for i := 0; i <= lastSpecialTx; i++ {
specialTxs = append(specialTxs, accTxs[i]) specialTxs = append(specialTxs, accTxs[i])

View file

@ -281,7 +281,7 @@ func TestTransactionPriceNonceSort(t *testing.T) {
} }
} }
// Sort the transactions and cross check the nonce ordering // 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{} txs := Transactions{}
for tx := txset.Peek(); tx != nil; tx = txset.Peek() { for tx := txset.Peek(); tx != nil; tx = txset.Peek() {
@ -392,7 +392,7 @@ func TestTransactionTimeSort(t *testing.T) {
groups[addr] = append(groups[addr], tx) groups[addr] = append(groups[addr], tx)
} }
// Sort the transactions and cross check the nonce ordering // 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{} txs := Transactions{}
for tx := txset.Peek(); tx != nil; tx = txset.Peek() { for tx := txset.Peek(); tx != nil; tx = txset.Peek() {

View file

@ -352,7 +352,7 @@ func (w *worker) update() {
txs[acc] = append(txs[acc], tx) txs[acc] = append(txs[acc], tx)
} }
feeCapacity := state.GetTRC21FeeCapacityFromState(w.current.state) 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 tcount := w.current.tcount
w.current.commitTransactions(w.mux, feeCapacity, txset, specialTxs, w.chain, w.coinbase, &w.pendingLogsFeed) 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()) log.Error("[commitNewWork] fail to check if block is epoch switch block when fetching pending transactions", "BlockNum", header.Number, "Hash", header.Hash())
} }
if !isEpochSwitchBlock { if !isEpochSwitchBlock {
var signers map[common.Address]struct{}
pending := w.eth.TxPool().Pending(true) 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 { if atomic.LoadInt32(&w.mining) == 1 {