aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorsilence <wangsai.silence@qq.com>2019-01-17 23:49:12 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-01-17 23:49:12 +0800
commit66f0c464ccd431e94b3be2a91b58c084c2c1575d (patch)
tree4dc8b35f528471a1121cfed0a82b8818c51a2a32 /core
parent19bfcbf9117f39f54f698a0953534d90c08e9930 (diff)
downloadgo-tangerine-66f0c464ccd431e94b3be2a91b58c084c2c1575d.tar
go-tangerine-66f0c464ccd431e94b3be2a91b58c084c2c1575d.tar.gz
go-tangerine-66f0c464ccd431e94b3be2a91b58c084c2c1575d.tar.bz2
go-tangerine-66f0c464ccd431e94b3be2a91b58c084c2c1575d.tar.lz
go-tangerine-66f0c464ccd431e94b3be2a91b58c084c2c1575d.tar.xz
go-tangerine-66f0c464ccd431e94b3be2a91b58c084c2c1575d.tar.zst
go-tangerine-66f0c464ccd431e94b3be2a91b58c084c2c1575d.zip
core: only cache non-nil receipts from the database (#18447)
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.
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index c719883ee..156efe303 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -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
}