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

Function loadGenesisDoc

node/node.go:1420–1434  ·  view source on GitHub ↗

panics if failed to unmarshal bytes

(db dbm.DB)

Source from the content-addressed store, hash-verified

1418
1419// panics if failed to unmarshal bytes
1420func loadGenesisDoc(db dbm.DB) (*types.GenesisDoc, error) {
1421 b, err := db.Get(genesisDocKey)
1422 if err != nil {
1423 panic(err)
1424 }
1425 if len(b) == 0 {
1426 return nil, errors.New("genesis doc not found")
1427 }
1428 var genDoc *types.GenesisDoc
1429 err = tmjson.Unmarshal(b, &genDoc)
1430 if err != nil {
1431 panic(fmt.Sprintf("Failed to load genesis doc due to unmarshaling error: %v (bytes: %X)", err, b))
1432 }
1433 return genDoc, nil
1434}
1435
1436// panics if failed to marshal the given genesis document
1437func saveGenesisDoc(db dbm.DB, genDoc *types.GenesisDoc) error {

Callers 1

Calls 2

GetMethod · 0.65
UnmarshalMethod · 0.45

Tested by

no test coverage detected