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

Function loadAndCacheAccounts

blockproducer/storage.go:564–592  ·  view source on GitHub ↗
(st xi.Storage, view *metaState)

Source from the content-addressed store, hash-verified

562}
563
564func loadAndCacheAccounts(st xi.Storage, view *metaState) (err error) {
565 var (
566 rows *sql.Rows
567 hex string
568 addr hash.Hash
569 enc []byte
570 )
571
572 if rows, err = st.Reader().Query(`SELECT "address", "encoded" FROM "accounts"`); err != nil {
573 return
574 }
575 defer rows.Close()
576
577 for rows.Next() {
578 if err = rows.Scan(&hex, &enc); err != nil {
579 return
580 }
581 if err = hash.Decode(&addr, hex); err != nil {
582 return
583 }
584 var dec = &types.Account{}
585 if err = utils.DecodeMsgPack(enc, dec); err != nil {
586 return
587 }
588 view.readonly.accounts[proto.AccountAddress(addr)] = dec
589 }
590
591 return
592}
593
594func loadAndCacheShardChainProfiles(st xi.Storage, view *metaState) (err error) {
595 var (

Callers 1

loadImmutableStateFunction · 0.85

Calls 8

DecodeFunction · 0.92
DecodeMsgPackFunction · 0.92
AccountAddressTypeAlias · 0.92
QueryMethod · 0.65
ReaderMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected