From aee88cf4e5e68208bbe327b43ed1a678ad5ad356 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Sun, 15 Jul 2018 09:29:10 -0500 Subject: [PATCH] core: check txn length when building a transaction set --- core/types/transaction.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index 82af9335ff..76ca331f8c 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -331,12 +331,14 @@ func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transa // Initialize a price based heap with the head transactions heads := make(TxByPrice, 0, len(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) + if len(accTxs) > 0 { + 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)