go-ethereum/core/bor_blockchain.go
Arpit Temani 08b4937cb6 fix lint
2023-09-23 16:26:23 +05:30

31 lines
735 B
Go

package core
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
)
// GetBorReceiptByHash retrieves the bor block receipt in a given block.
func (bc *BlockChain) GetBorReceiptByHash(hash common.Hash) *types.Receipt {
if receipt, ok := bc.borReceiptsCache.Get(hash); ok {
return receipt
}
// read header from hash
number := rawdb.ReadHeaderNumber(bc.db, hash)
if number == nil {
return nil
}
// read bor receipt by hash and number
receipt := rawdb.ReadBorReceipt(bc.db, hash, *number, bc.chainConfig)
if receipt == nil {
return nil
}
// add into bor receipt cache
bc.borReceiptsCache.Add(hash, receipt)
return receipt
}