diff options
author | obscuren <obscuren@obscura.com> | 2013-12-30 06:53:20 +0800 |
---|---|---|
committer | obscuren <obscuren@obscura.com> | 2013-12-30 06:53:20 +0800 |
commit | ad048e9f445ff96b7bfd75c104ab923e1e06754b (patch) | |
tree | 797343c162b15b44f0d4f91af7b3942e2cd6fd42 /ethereum.go | |
parent | 0edcbc695e3e80d2f417467905621505f9971b4f (diff) | |
download | dexon-ad048e9f445ff96b7bfd75c104ab923e1e06754b.tar.gz dexon-ad048e9f445ff96b7bfd75c104ab923e1e06754b.tar.zst dexon-ad048e9f445ff96b7bfd75c104ab923e1e06754b.zip |
update test
Diffstat (limited to 'ethereum.go')
-rw-r--r-- | ethereum.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/ethereum.go b/ethereum.go index 52e6e3046..d9e1fd314 100644 --- a/ethereum.go +++ b/ethereum.go @@ -2,10 +2,27 @@ package main import ( "fmt" + "os" + "os/signal" ) const Debug = false +// 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.Println("Shutting down (%v) ... \n", sig) + + s.Stop() + } + }() +} + func main() { InitFees() @@ -30,17 +47,11 @@ func main() { copyTx := &Transaction{} copyTx.UnmarshalRlp(txData) - tx2 := NewTransaction("\x00", 20, []string{"SET 10 6", "LD 10 10"}) - blck := NewBlock([]*Transaction{tx2, tx}) + blck := CreateBlock([]*Transaction{tx2, tx}) bm.ProcessBlock( blck ) - t := blck.MarshalRlp() - copyBlock := &Block{} - copyBlock.UnmarshalRlp(t) - - fmt.Println(blck) - fmt.Println(copyBlock) + fmt.Println("GenesisBlock:", GenisisBlock, "hashed", GenisisBlock.Hash()) } |