From 9513fbd2648932e034eb03f36bd92b308d1b353d Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Mon, 22 Nov 2021 14:51:38 +0100 Subject: [PATCH] Write bor receipts in ancient --- core/blockchain.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/blockchain.go b/core/blockchain.go index cc21b24eba..753ca4abb2 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -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]) } + // 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. 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 if err != nil { log.Error("Error importing chain data to ancients", "err", err)