diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-24 17:34:06 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-24 17:34:06 +0800 |
commit | a59ea7ce297d2bb26cee9ff295f622697645e49c (patch) | |
tree | 13c6feda5b05430911ebbc5492a485dfd59c54ae /miner/remote_agent.go | |
parent | d8e21b39b30f3951c17a618baffcc3592afae0b1 (diff) | |
download | dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.gz dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.bz2 dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.lz dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.xz dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.zst dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.zip |
Changed miner
* Instead of delivering `Work` to the `Worker`, push a complete Block to
the `Worker` so that each agent can work on their own block.
Diffstat (limited to 'miner/remote_agent.go')
-rw-r--r-- | miner/remote_agent.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/miner/remote_agent.go b/miner/remote_agent.go index 3911ac61e..e92dd5963 100644 --- a/miner/remote_agent.go +++ b/miner/remote_agent.go @@ -12,7 +12,7 @@ type RemoteAgent struct { quit chan struct{} workCh chan *types.Block - returnCh chan<- Work + returnCh chan<- *types.Block } func NewRemoteAgent() *RemoteAgent { @@ -25,7 +25,7 @@ func (a *RemoteAgent) Work() chan<- *types.Block { return a.workCh } -func (a *RemoteAgent) SetWorkCh(returnCh chan<- Work) { +func (a *RemoteAgent) SetReturnCh(returnCh chan<- *types.Block) { a.returnCh = returnCh } @@ -72,8 +72,11 @@ func (a *RemoteAgent) SubmitWork(nonce uint64, mixDigest, seedHash common.Hash) // Return true or false, but does not indicate if the PoW was correct // Make sure the external miner was working on the right hash - if a.currentWork != nil && a.work != nil && a.currentWork.Hash() == a.work.Hash() { - a.returnCh <- Work{a.currentWork.Number().Uint64(), nonce, mixDigest.Bytes(), seedHash.Bytes()} + if a.currentWork != nil && a.work != nil { + a.currentWork.SetNonce(nonce) + a.currentWork.Header().MixDigest = mixDigest + a.returnCh <- a.currentWork + //a.returnCh <- Work{a.currentWork.Number().Uint64(), nonce, mixDigest.Bytes(), seedHash.Bytes()} return true } |