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

Method procFutureBlocks

core/blockchain.go:840–858  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

838}
839
840func (bc *BlockChain) procFutureBlocks() {
841 blocks := make([]*types.Block, 0, bc.futureBlocks.Len())
842 for _, hash := range bc.futureBlocks.Keys() {
843 if block, exist := bc.futureBlocks.Peek(hash); exist {
844 blocks = append(blocks, block.(*types.Block))
845 }
846 }
847
848 if len(blocks) > 0 {
849 types.BlockBy(types.Number).Sort(blocks)
850
851 // Insert one by one as chain insertion needs contiguous ancestry between blocks
852 for i := range blocks {
853 _, err := bc.InsertChain(blocks[i : i+1])
854 bc.ErrChan <- err
855 log.Debug("err of future insert, go to bc.ErrChan", "err", err)
856 }
857 }
858}
859
860func (bc *BlockChain) procUnknownAncestors() {
861 blocks := make([]*types.Block, 0, bc.unknownAncestors.Len())

Callers 1

updateMethod · 0.95

Calls 6

InsertChainMethod · 0.95
PeekMethod · 0.80
SortMethod · 0.80
DebugMethod · 0.80
LenMethod · 0.65
KeysMethod · 0.45

Tested by

no test coverage detected