panics if failed to unmarshal bytes
(db dbm.DB)
| 1418 | |
| 1419 | // panics if failed to unmarshal bytes |
| 1420 | func 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 |
| 1437 | func saveGenesisDoc(db dbm.DB, genDoc *types.GenesisDoc) error { |
no test coverage detected