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

Method CurrentBlock

core/blockchain.go:474–481  ·  view source on GitHub ↗

CurrentBlock retrieves the current head block of the canonical chain. The block is retrieved from the blockchain's internal cache.

()

Source from the content-addressed store, hash-verified

472// CurrentBlock retrieves the current head block of the canonical chain. The
473// block is retrieved from the blockchain's internal cache.
474func (bc *BlockChain) CurrentBlock() *types.Block {
475 bc.syncModeMutex.Lock()
476 defer bc.syncModeMutex.Unlock()
477 if bc.syncMode == syncer.FullSync {
478 return bc.currentBlock.Load().(*types.Block)
479 }
480 return bc.CurrentFastBlock()
481}
482
483// CurrentFastBlock retrieves the current fast-sync head block of the canonical
484// chain. The block is retrieved from the blockchain's internal cache.

Callers 15

ExampleGenerateChainFunction · 0.95
NewBlockChainFunction · 0.95
SetHeadMethod · 0.95
GasLimitMethod · 0.95
StateMethod · 0.95
StatePrivMethod · 0.95
ExportMethod · 0.95
CommitStateDBMethod · 0.95
procUnknownAncestorsMethod · 0.95
RollbackMethod · 0.95
WriteBlockWithStateMethod · 0.95
InsertChainMethod · 0.95

Calls 3

CurrentFastBlockMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80