MCPcopy Index your code
hub / github.com/chain/Core / ProcessBlocks

Method ProcessBlocks

core/pin/pin.go:35–54  ·  view source on GitHub ↗
(ctx context.Context, c *protocol.Chain, pinName string, cb func(context.Context, *legacy.Block) error)

Source from the content-addressed store, hash-verified

33}
34
35func (s *Store) ProcessBlocks(ctx context.Context, c *protocol.Chain, pinName string, cb func(context.Context, *legacy.Block) error) {
36 p := <-s.pin(pinName)
37 height := p.getHeight()
38 for {
39 select {
40 case <-ctx.Done(): // leader deposed
41 log.Error(ctx, ctx.Err())
42 return
43 case <-c.BlockWaiter(height + 1):
44 select {
45 case <-ctx.Done():
46 log.Error(ctx, ctx.Err())
47 return
48 case p.sem <- true:
49 go p.processBlock(ctx, c, height+1, cb)
50 height++
51 }
52 }
53 }
54}
55
56func (s *Store) CreatePin(ctx context.Context, name string, height uint64) error {
57 s.mu.Lock()

Callers 3

TestProcessBlocksFunction · 0.95
TestTransferFunction · 0.45
leadMethod · 0.45

Implementers 2

MemStoreprotocol/prottest/memstore/memstore.go
Storecore/txdb/store.go

Calls 6

pinMethod · 0.95
BlockWaiterMethod · 0.80
processBlockMethod · 0.80
getHeightMethod · 0.45
ErrorMethod · 0.45
ErrMethod · 0.45

Tested by 2

TestProcessBlocksFunction · 0.76
TestTransferFunction · 0.36