Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,13 @@ func WriteBodyRLP(db ctxcdb.KeyValueWriter, hash common.Hash, number uint64, rlp
// HasBody verifies the existence of a block body corresponding to the hash.
func HasBody(db ctxcdb.Reader, hash common.Hash, number uint64) bool {
if isCanon(db, number, hash) {
return true
// Block is in ancient store, but bodies can be pruned.
// Check if the block number is above the pruning tail.
tail, _ := db.Tail()
if number >= tail {
return true
}
return false
}
if has, err := db.Has(blockBodyKey(number, hash)); !has || err != nil {
return false
Expand Down Expand Up @@ -603,7 +609,13 @@ func DeleteTd(db ctxcdb.KeyValueWriter, hash common.Hash, number uint64) {
// to a block.
func HasReceipts(db ctxcdb.Reader, hash common.Hash, number uint64) bool {
if isCanon(db, number, hash) {
return true
// Block is in ancient store, but receipts can be pruned.
// Check if the block number is above the pruning tail.
tail, _ := db.Tail()
if number >= tail {
return true
}
return false
}
if has, err := db.Has(blockReceiptsKey(number, hash)); !has || err != nil {
return false
Expand Down
Loading