MCPcopy Create free account
hub / github.com/CPChain/chain / reportBlock

Method reportBlock

core/blockchain.go:1798–1816  ·  view source on GitHub ↗

reportBlock logs a bad block error.

(block *types.Block, receipts types.Receipts, err error)

Source from the content-addressed store, hash-verified

1796
1797// reportBlock logs a bad block error.
1798func (bc *BlockChain) reportBlock(block *types.Block, receipts types.Receipts, err error) {
1799 bc.addBadBlock(block)
1800
1801 var receiptString string
1802 for _, receipt := range receipts {
1803 receiptString += fmt.Sprintf("\t%v\n", receipt)
1804 }
1805 log.Error(fmt.Sprintf(`
1806########## BAD BLOCK #########
1807Chain config: %v
1808
1809Number: %v
1810Hash: 0x%x
1811%v
1812
1813Error: %v
1814##############################
1815`, bc.chainConfig, block.Number(), block.Hash(), receiptString, err))
1816}
1817
1818// InsertHeaderChain attempts to insert the given header chain in to the local
1819// chain, possibly creating a reorg. If an error is returned, it will return the

Callers 2

insertChainMethod · 0.95
testBlockChainImportFunction · 0.80

Calls 4

addBadBlockMethod · 0.95
ErrorMethod · 0.65
HashMethod · 0.65
NumberMethod · 0.45

Tested by 1

testBlockChainImportFunction · 0.64