Skip to content

Commit

Permalink
refactor to pass test
Browse files Browse the repository at this point in the history
  • Loading branch information
carryforward committed Jan 24, 2018
1 parent 8f8bb9e commit 02cabcb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions state/loadDatabase.go
Expand Up @@ -79,12 +79,14 @@ func LoadDatabase(s *State) {
s.Println("******* New Database **************")
s.Println("***********************************\n")

customIdentity, err := primitives.HexToHash(s.CustomBootstrapIdentity)
if err != nil {
panic(fmt.Sprintf("Could not decode Custom Bootstrap Identity (likely in config file) found: %s\n", s.CustomBootstrapIdentity))
var customIdentity interfaces.IHash
if s.Network == "CUSTOM" {
customIdentity, err = primitives.HexToHash(s.CustomBootstrapIdentity)
if err != nil {
panic(fmt.Sprintf("Could not decode Custom Bootstrap Identity (likely in config file) found: %s\n", s.CustomBootstrapIdentity))
}
}
dblk, ablk, fblk, ecblk := GenerateGenesisBlocks(s.GetNetworkID(), customIdentity)

msg := messages.NewDBStateMsg(s.GetTimestamp(), dblk, ablk, fblk, ecblk, nil, nil, nil)
s.InMsgQueue().Enqueue(msg)
}
Expand Down

0 comments on commit 02cabcb

Please sign in to comment.