Skip to content

Commit

Permalink
core/txpool/blobpool: avoid possible zero index panic (#30430)
Browse files Browse the repository at this point in the history
This situation(`len(txs) == 0`) rarely occurs, but if it does, it will
panic.

---------

Co-authored-by: Martin HS <martin@swende.se>
  • Loading branch information
mask-pp and holiman committed Sep 14, 2024
1 parent 07b5a04 commit 0dd7e82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/txpool/blobpool/blobpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6
ids []uint64
nonces []uint64
)
for txs[0].nonce < next {
for len(txs) > 0 && txs[0].nonce < next {
ids = append(ids, txs[0].id)
nonces = append(nonces, txs[0].nonce)

Expand Down

0 comments on commit 0dd7e82

Please sign in to comment.