diff options
author | kimmylin <30611210+kimmylin@users.noreply.github.com> | 2018-04-24 15:39:03 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-04-24 15:39:03 +0800 |
commit | 86be91b3e2dff5df28ee53c59df1ecfe9f97e007 (patch) | |
tree | 52aba6594a7260d894ce5901519985efcecfbfde /core/types | |
parent | e7067be94f0edb47b39d4fa1725bce18bdadf122 (diff) | |
download | dexon-86be91b3e2dff5df28ee53c59df1ecfe9f97e007.tar dexon-86be91b3e2dff5df28ee53c59df1ecfe9f97e007.tar.gz dexon-86be91b3e2dff5df28ee53c59df1ecfe9f97e007.tar.bz2 dexon-86be91b3e2dff5df28ee53c59df1ecfe9f97e007.tar.lz dexon-86be91b3e2dff5df28ee53c59df1ecfe9f97e007.tar.xz dexon-86be91b3e2dff5df28ee53c59df1ecfe9f97e007.tar.zst dexon-86be91b3e2dff5df28ee53c59df1ecfe9f97e007.zip |
core/types: avoid duplicating transactions on changing signer (#16435)
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/transaction.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/types/transaction.go b/core/types/transaction.go index 92fd8f898..c1cb7a043 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -339,11 +339,14 @@ type TransactionsByPriceAndNonce struct { func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transactions) *TransactionsByPriceAndNonce { // Initialize a price based heap with the head transactions heads := make(TxByPrice, 0, len(txs)) - for _, accTxs := range txs { + for from, accTxs := range txs { heads = append(heads, accTxs[0]) // Ensure the sender address is from the signer acc, _ := Sender(signer, accTxs[0]) txs[acc] = accTxs[1:] + if from != acc { + delete(txs, from) + } } heap.Init(&heads) |