MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / loadValidatorsInfo

Function loadValidatorsInfo

state/store.go:529–549  ·  view source on GitHub ↗

CONTRACT: Returned ValidatorsInfo can be mutated.

(db dbm.DB, height int64)

Source from the content-addressed store, hash-verified

527
528// CONTRACT: Returned ValidatorsInfo can be mutated.
529func loadValidatorsInfo(db dbm.DB, height int64) (*tmstate.ValidatorsInfo, error) {
530 buf, err := db.Get(calcValidatorsKey(height))
531 if err != nil {
532 return nil, err
533 }
534
535 if len(buf) == 0 {
536 return nil, errors.New("value retrieved from db is empty")
537 }
538
539 v := new(tmstate.ValidatorsInfo)
540 err = v.Unmarshal(buf)
541 if err != nil {
542 // DATA HAS BEEN CORRUPTED OR THE SPEC HAS CHANGED
543 tmos.Exit(fmt.Sprintf(`LoadValidators: Data has been corrupted or its spec has changed:
544 %v\n`, err))
545 }
546 // TODO: ensure that buf is completely read.
547
548 return v, nil
549}
550
551// saveValidatorsInfo persists the validator set.
552//

Callers 2

PruneStatesMethod · 0.85
LoadValidatorsMethod · 0.85

Calls 3

calcValidatorsKeyFunction · 0.85
GetMethod · 0.65
UnmarshalMethod · 0.45

Tested by

no test coverage detected