Skip to content

Commit 58c34e1

Browse files
countvonzerokimmyeonghun
authored andcommitted
core/types: avoid duplicating transactions on changing signer (ethereum#16435)
1 parent 6d2e3b6 commit 58c34e1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/types/transaction.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,14 @@ type TransactionsByPriceAndNonce struct {
339339
func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transactions) *TransactionsByPriceAndNonce {
340340
// Initialize a price based heap with the head transactions
341341
heads := make(TxByPrice, 0, len(txs))
342-
for _, accTxs := range txs {
342+
for from, accTxs := range txs {
343343
heads = append(heads, accTxs[0])
344344
// Ensure the sender address is from the signer
345345
acc, _ := Sender(signer, accTxs[0])
346346
txs[acc] = accTxs[1:]
347+
if from != acc {
348+
delete(txs, from)
349+
}
347350
}
348351
heap.Init(&heads)
349352

0 commit comments

Comments
 (0)