mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 22:56:43 +00:00
core/txpool/blobpool: prevent panic in case of nil pointer
This commit is contained in:
parent
52aef17fd3
commit
2a341854c7
1 changed files with 8 additions and 2 deletions
|
|
@ -50,7 +50,10 @@ func (l *lookup) exists(txhash common.Hash) bool {
|
||||||
// storeidOfTx returns the datastore storage item id of a transaction.
|
// storeidOfTx returns the datastore storage item id of a transaction.
|
||||||
func (l *lookup) storeidOfTx(txhash common.Hash) (uint64, bool) {
|
func (l *lookup) storeidOfTx(txhash common.Hash) (uint64, bool) {
|
||||||
meta, ok := l.txIndex[txhash]
|
meta, ok := l.txIndex[txhash]
|
||||||
return meta.id, ok
|
if !ok {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
return meta.id, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// storeidOfBlob returns the datastore storage item id of a blob.
|
// storeidOfBlob returns the datastore storage item id of a blob.
|
||||||
|
|
@ -70,7 +73,10 @@ func (l *lookup) storeidOfBlob(vhash common.Hash) (uint64, bool) {
|
||||||
// sizeOfTx returns the RLP-encoded size of transaction
|
// sizeOfTx returns the RLP-encoded size of transaction
|
||||||
func (l *lookup) sizeOfTx(txhash common.Hash) (uint64, bool) {
|
func (l *lookup) sizeOfTx(txhash common.Hash) (uint64, bool) {
|
||||||
meta, ok := l.txIndex[txhash]
|
meta, ok := l.txIndex[txhash]
|
||||||
return meta.size, ok
|
if !ok {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
return meta.size, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// track inserts a new set of mappings from blob versioned hashes to transaction
|
// track inserts a new set of mappings from blob versioned hashes to transaction
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue