MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / loadBlock

Function loadBlock

blockproducer/storage.go:456–471  ·  view source on GitHub ↗
(st xi.Storage, hash hash.Hash)

Source from the content-addressed store, hash-verified

454}
455
456func loadBlock(st xi.Storage, hash hash.Hash) (block *types.BPBlock, err error) {
457 var (
458 enc []byte
459 dec = &types.BPBlock{}
460 )
461 if err = st.Reader().QueryRow(
462 `SELECT "encoded" FROM "blocks" WHERE "hash"=?`, hash.String(),
463 ).Scan(&enc); err != nil {
464 return
465 }
466 if err = utils.DecodeMsgPack(enc, dec); err != nil {
467 return
468 }
469 block = dec
470 return
471}
472
473func loadBlocks(
474 st xi.Storage, irreHash hash.Hash) (lastIrre *blockNode, heads []*blockNode, err error,

Callers 2

NewChainWithContextFunction · 0.85
loadBlockMethod · 0.85

Calls 5

DecodeMsgPackFunction · 0.92
QueryRowMethod · 0.80
ReaderMethod · 0.65
ScanMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected