Update blockchain.go

receipts may be null for very short time in some condition. For this case, we should not add the null value into cache. Because you will not get the right result if you keep requesting that receipt.
This commit is contained in:
silence 2019-01-15 14:34:13 +08:00 committed by Péter Szilágyi
parent 4f8ec44565
commit ec526af8d1
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D

View file

@ -644,6 +644,9 @@ func (bc *BlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts {
return nil
}
receipts := rawdb.ReadReceipts(bc.db, hash, *number)
if receipts == nil {
return nil
}
bc.receiptsCache.Add(hash, receipts)
return receipts
}