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

Method HasBlockAndState

core/blockchain.go:701–708  ·  view source on GitHub ↗

HasBlockAndState checks if a block and associated state trie is fully present in the database or not, caching it if present.

(hash common.Hash, number uint64)

Source from the content-addressed store, hash-verified

699// HasBlockAndState checks if a block and associated state trie is fully present
700// in the database or not, caching it if present.
701func (bc *BlockChain) HasBlockAndState(hash common.Hash, number uint64) bool {
702 // Check first that the block itself is known
703 block := bc.GetBlock(hash, number)
704 if block == nil {
705 return false
706 }
707 return bc.HasState(block.StateRoot())
708}
709
710// GetBlock retrieves a block from the database by hash and number,
711// caching it if found.

Callers 2

ValidateBodyMethod · 0.80
missingBlocksFunction · 0.80

Calls 3

GetBlockMethod · 0.95
HasStateMethod · 0.95
StateRootMethod · 0.80

Tested by

no test coverage detected