Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
Fix an out-of-bound printing stuff issue. Also, don't exit if you're …
Browse files Browse the repository at this point in the history
…not in

a network.
  • Loading branch information
abourget committed May 29, 2018
1 parent c2593ac commit 5fb6ee6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bios/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,15 @@ func (net *Network) MyNetwork() *simple.WeightedDirectedGraph {
if network == nil {
if len(net.MyPeer.Discovery.SeedNetworkPeers) == 0 {
net.Log.Println("You are part of no network. Either define a `seed_network_peers` to point to some peers in a network, or ask to be pointed to by someone in a network")
os.Exit(1)
return nil
//os.Exit(1)
}

network = net.NetworkThatIncludes(net.MyPeer.Discovery.SeedNetworkPeers[0].Account)
if network == nil {
net.Log.Println("You're part of no network, and your first peer in `seed_network_peers` isn't either (!!)")
os.Exit(1)
return nil
//os.Exit(1)
}
}

Expand All @@ -533,10 +535,12 @@ func (net *Network) PrintOrderedPeers(orderedPeers []*Peer) {

net.Log.Println("###############################################################################################")
net.Log.Println("#################################### PEER NETWORK #######################################")
targetBlock := orderedPeers[0].Discovery.SeedNetworkLaunchBlock
targetTime, currentBlock, _ := net.LaunchBlockTime(uint32(targetBlock))
net.Log.Printf("Target launch block: %d, %s (current: %d)\n", targetBlock, humanize.Time(targetTime), currentBlock)
net.Log.Println("")
if len(orderedPeers) > 1 {
targetBlock := orderedPeers[0].Discovery.SeedNetworkLaunchBlock
targetTime, currentBlock, _ := net.LaunchBlockTime(uint32(targetBlock))
net.Log.Printf("Target launch block: %d, %s (current: %d)\n", targetBlock, humanize.Time(targetTime), currentBlock)
net.Log.Println("")
}

columns := []string{
"Role | Seed Account | Target Acct | Weight | GMT | Launch Block | Contents",
Expand Down

0 comments on commit 5fb6ee6

Please sign in to comment.