Skip to content

Commit

Permalink
core: only cache non-nil receipts from the database (ethereum#18447)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wangsai-silence authored and karalabe committed Jan 17, 2019
1 parent 19bfcbf commit 66f0c46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 66f0c46

Please sign in to comment.