MCPcopy
hub / github.com/hyperledger/fabric / GetBlocks

Method GetBlocks

core/committer/committer_impl.go:102–116  ·  view source on GitHub ↗

GetBlocks used to retrieve blocks with sequence numbers provided in the slice

(blockSeqs []uint64)

Source from the content-addressed store, hash-verified

100
101// GetBlocks used to retrieve blocks with sequence numbers provided in the slice
102func (lc *LedgerCommitter) GetBlocks(blockSeqs []uint64) []*common.Block {
103 var blocks []*common.Block
104
105 for _, seqNum := range blockSeqs {
106 if blck, err := lc.GetBlockByNumber(seqNum); err != nil {
107 logger.Errorf("Not able to acquire block num %d, from the ledger skipping...", seqNum)
108 continue
109 } else {
110 logger.Debug("Appending next block with seqNum = ", seqNum, " to the resulting set")
111 blocks = append(blocks, blck)
112 }
113 }
114
115 return blocks
116}

Callers 1

TestKVLedgerBlockStorageFunction · 0.95

Calls 3

DebugMethod · 0.80
GetBlockByNumberMethod · 0.65
ErrorfMethod · 0.65

Tested by 1

TestKVLedgerBlockStorageFunction · 0.76