aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/dagger.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-03-20 18:20:29 +0800
committerMaran <maran.hidskes@gmail.com>2014-03-20 18:20:29 +0800
commitae837c4719855384921fcaadb1a575942dc9833d (patch)
tree3981f671c02ac6874c849cab7186cecf80d24e2f /ethchain/dagger.go
parent2be2fc79740d942f9690268352465d117930f081 (diff)
downloadgo-tangerine-ae837c4719855384921fcaadb1a575942dc9833d.tar
go-tangerine-ae837c4719855384921fcaadb1a575942dc9833d.tar.gz
go-tangerine-ae837c4719855384921fcaadb1a575942dc9833d.tar.bz2
go-tangerine-ae837c4719855384921fcaadb1a575942dc9833d.tar.lz
go-tangerine-ae837c4719855384921fcaadb1a575942dc9833d.tar.xz
go-tangerine-ae837c4719855384921fcaadb1a575942dc9833d.tar.zst
go-tangerine-ae837c4719855384921fcaadb1a575942dc9833d.zip
More mining rework
Diffstat (limited to 'ethchain/dagger.go')
-rw-r--r--ethchain/dagger.go16
1 files changed, 5 insertions, 11 deletions
diff --git a/ethchain/dagger.go b/ethchain/dagger.go
index 4d2034e20..a80a9d421 100644
--- a/ethchain/dagger.go
+++ b/ethchain/dagger.go
@@ -11,7 +11,7 @@ import (
)
type PoW interface {
- Search(block *Block, minerChan chan ethutil.React) []byte
+ Search(block *Block, reactChan chan ethutil.React) []byte
Verify(hash []byte, diff *big.Int, nonce []byte) bool
}
@@ -19,7 +19,7 @@ type EasyPow struct {
hash *big.Int
}
-func (pow *EasyPow) Search(block *Block, minerChan chan ethutil.React) []byte {
+func (pow *EasyPow) Search(block *Block, reactChan chan ethutil.React) []byte {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
hash := block.HashNoNonce()
diff := block.Difficulty
@@ -28,15 +28,9 @@ func (pow *EasyPow) Search(block *Block, minerChan chan ethutil.React) []byte {
for {
select {
- case chanMessage := <-minerChan:
- if _, ok := chanMessage.Resource.(*Block); ok {
- log.Println("BREAKING OUT: BLOCK")
- return nil
- }
- if _, ok := chanMessage.Resource.(*Transaction); ok {
- log.Println("BREAKING OUT: TX")
- return nil
- }
+ case <-reactChan:
+ log.Println("[pow] Received reactor event; breaking out.")
+ return nil
default:
i++
if i%1234567 == 0 {