Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit 8a0e671

Browse files
countvonzerogbalint
authored andcommitted
core/types: avoid duplicating transactions on changing signer (#16435)
1 parent d68fa66 commit 8a0e671

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)