diff options
author | obscuren <geffobscura@gmail.com> | 2014-01-11 22:27:08 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-01-11 22:27:08 +0800 |
commit | 9571a512861d4a44c36d368f4baa15b2aa81c37d (patch) | |
tree | c5412a119ab885570351f42e512dd2d62d0bae61 /ethereum.go | |
parent | 8bbf879cb31e9cb28700773ed788421f9935ac36 (diff) | |
download | dexon-9571a512861d4a44c36d368f4baa15b2aa81c37d.tar.gz dexon-9571a512861d4a44c36d368f4baa15b2aa81c37d.tar.zst dexon-9571a512861d4a44c36d368f4baa15b2aa81c37d.zip |
gofmt no coding standards
Diffstat (limited to 'ethereum.go')
-rw-r--r-- | ethereum.go | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/ethereum.go b/ethereum.go index 96b67f970..dd5b44308 100644 --- a/ethereum.go +++ b/ethereum.go @@ -1,85 +1,85 @@ package main import ( - "fmt" - "os" - "os/signal" - "flag" - "runtime" - "log" - "github.com/ethereum/ethutil-go" + "flag" + "fmt" + "github.com/ethereum/ethutil-go" + "log" + "os" + "os/signal" + "runtime" ) const Debug = true var StartConsole bool var StartMining bool + func Init() { - flag.BoolVar(&StartConsole, "c", false, "debug and testing console") - flag.BoolVar(&StartMining, "m", false, "start dagger mining") + flag.BoolVar(&StartConsole, "c", false, "debug and testing console") + flag.BoolVar(&StartMining, "m", false, "start dagger mining") - flag.Parse() + flag.Parse() } // Register interrupt handlers so we can stop the server func RegisterInterupts(s *Server) { - // Buffered chan of one is enough - c := make(chan os.Signal, 1) - // Notify about interrupts for now - signal.Notify(c, os.Interrupt) - go func() { - for sig := range c { - fmt.Printf("Shutting down (%v) ... \n", sig) - - s.Stop() - } - }() + // Buffered chan of one is enough + c := make(chan os.Signal, 1) + // Notify about interrupts for now + signal.Notify(c, os.Interrupt) + go func() { + for sig := range c { + fmt.Printf("Shutting down (%v) ... \n", sig) + + s.Stop() + } + }() } func main() { - runtime.GOMAXPROCS(runtime.NumCPU()) - - ethutil.InitFees() - - Init() - - if StartConsole { - console := NewConsole() - console.Start() - } else{ - log.Println("Starting Ethereum") - server, err := NewServer() - - if err != nil { - log.Println(err) - return - } - - RegisterInterupts(server) - - if StartMining { - log.Println("Mining started") - dagger := &Dagger{} - - go func() { - for { - res := dagger.Search(ethutil.Big("0"), ethutil.BigPow(2, 36)) - server.Broadcast("block", Encode(res.String())) - } - }() - } - - server.Start() - - err = server.ConnectToPeer("localhost:12345") - if err != nil { - log.Println(err) - server.Stop() - return - } - - - // Wait for shutdown - server.WaitForShutdown() - } + runtime.GOMAXPROCS(runtime.NumCPU()) + + ethutil.InitFees() + + Init() + + if StartConsole { + console := NewConsole() + console.Start() + } else { + log.Println("Starting Ethereum") + server, err := NewServer() + + if err != nil { + log.Println(err) + return + } + + RegisterInterupts(server) + + if StartMining { + log.Println("Mining started") + dagger := &Dagger{} + + go func() { + for { + res := dagger.Search(ethutil.Big("0"), ethutil.BigPow(2, 36)) + server.Broadcast("block", Encode(res.String())) + } + }() + } + + server.Start() + + err = server.ConnectToPeer("localhost:12345") + if err != nil { + log.Println(err) + server.Stop() + return + } + + // Wait for shutdown + server.WaitForShutdown() + } } |