Skip to content

Commit

Permalink
fix: bubbling up the error when DeriveField() fails (bnb-chain#18)
Browse files Browse the repository at this point in the history
Co-authored-by: Welkin <welkin.b@nodereal.com>
  • Loading branch information
welkin22 and Welkin authored Jan 5, 2024
1 parent e13d451 commit 1f69107
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1874,11 +1874,14 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
proctime := time.Since(start) // processing + validation

// pre-cache the block and receipts, so that it can be retrieved quickly by rcp
bc.CacheBlock(block.Hash(), block)
err = types.Receipts(receipts).DeriveFields(bc.chainConfig, block.Hash(), block.NumberU64(), block.Time(), block.BaseFee(), block.Transactions())
if err != nil {
log.Warn("Failed to derive receipt fields", "block", block.Hash(), "err", err)
bc.reportBlock(block, receipts, err)
close(interruptCh)
return it.index, err
}
bc.CacheBlock(block.Hash(), block)
bc.CacheReceipts(block.Hash(), receipts)

// Update the metrics touched during block processing and validation
Expand Down

0 comments on commit 1f69107

Please sign in to comment.