Write bor receipts in ancient

This commit is contained in:
Ferran Borreguero 2021-11-22 14:51:38 +01:00
parent c55094aeb5
commit 9513fbd264

View file

@ -1221,9 +1221,15 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [
return 0, fmt.Errorf("containing header #%d [%x..] unknown", last.Number(), last.Hash().Bytes()[:4]) return 0, fmt.Errorf("containing header #%d [%x..] unknown", last.Number(), last.Hash().Bytes()[:4])
} }
// BOR: Retrieve all the bor receipts.
borReceipts := types.Receipts{}
for _, block := range blockChain {
borReceipts = append(borReceipts, bc.GetBorReceiptByHash(block.Hash()))
}
// Write all chain data to ancients. // Write all chain data to ancients.
td := bc.GetTd(first.Hash(), first.NumberU64()) td := bc.GetTd(first.Hash(), first.NumberU64())
writeSize, err := rawdb.WriteAncientBlocks(bc.db, blockChain, receiptChain, []types.Receipts{d}, td) writeSize, err := rawdb.WriteAncientBlocks(bc.db, blockChain, receiptChain, []types.Receipts{borReceipts}, td)
size += writeSize size += writeSize
if err != nil { if err != nil {
log.Error("Error importing chain data to ancients", "err", err) log.Error("Error importing chain data to ancients", "err", err)