mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
core: check txn length when building a transaction set
This commit is contained in:
parent
2e0391ea84
commit
aee88cf4e5
1 changed files with 8 additions and 6 deletions
|
|
@ -331,12 +331,14 @@ func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transa
|
||||||
// Initialize a price based heap with the head transactions
|
// Initialize a price based heap with the head transactions
|
||||||
heads := make(TxByPrice, 0, len(txs))
|
heads := make(TxByPrice, 0, len(txs))
|
||||||
for from, accTxs := range txs {
|
for from, accTxs := range txs {
|
||||||
heads = append(heads, accTxs[0])
|
if len(accTxs) > 0 {
|
||||||
// Ensure the sender address is from the signer
|
heads = append(heads, accTxs[0])
|
||||||
acc, _ := Sender(signer, accTxs[0])
|
// Ensure the sender address is from the signer
|
||||||
txs[acc] = accTxs[1:]
|
acc, _ := Sender(signer, accTxs[0])
|
||||||
if from != acc {
|
txs[acc] = accTxs[1:]
|
||||||
delete(txs, from)
|
if from != acc {
|
||||||
|
delete(txs, from)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
heap.Init(&heads)
|
heap.Init(&heads)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue