File tree Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -423,9 +423,9 @@ func CalcUncleHash(uncles []*Header) common.Hash {
423
423
424
424
// WithMiningResult returns a new block with the data from b
425
425
// where nonce and mix digest are set to the provided values.
426
- func (b * Block ) WithMiningResult (nonce uint64 , mixDigest common.Hash ) * Block {
426
+ func (b * Block ) WithMiningResult (nonce BlockNonce , mixDigest common.Hash ) * Block {
427
427
cpy := * b .header
428
- binary . BigEndian . PutUint64 ( cpy .Nonce [:], nonce )
428
+ cpy .Nonce = nonce
429
429
cpy .MixDigest = mixDigest
430
430
return & Block {
431
431
header : & cpy ,
Original file line number Diff line number Diff line change @@ -96,8 +96,8 @@ func (s *PublicMinerAPI) Mining() bool {
96
96
97
97
// SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was
98
98
// accepted. Note, this is not an indication if the provided work was valid!
99
- func (s * PublicMinerAPI ) SubmitWork (nonce hexutil. Uint64 , solution , digest common.Hash ) bool {
100
- return s .agent .SubmitWork (uint64 ( nonce ) , digest , solution )
99
+ func (s * PublicMinerAPI ) SubmitWork (nonce types. BlockNonce , solution , digest common.Hash ) bool {
100
+ return s .agent .SubmitWork (nonce , digest , solution )
101
101
}
102
102
103
103
// GetWork returns a work package for external miner. The work package consists of 3 strings
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"sync/atomic"
23
23
24
24
"github.com/ethereum/go-ethereum/common"
25
+ "github.com/ethereum/go-ethereum/core/types"
25
26
"github.com/ethereum/go-ethereum/logger"
26
27
"github.com/ethereum/go-ethereum/logger/glog"
27
28
"github.com/ethereum/go-ethereum/pow"
@@ -112,7 +113,7 @@ func (self *CpuAgent) mine(work *Work, stop <-chan struct{}) {
112
113
// Mine
113
114
nonce , mixDigest := self .pow .Search (work .Block , stop , self .index )
114
115
if nonce != 0 {
115
- block := work .Block .WithMiningResult (nonce , common .BytesToHash (mixDigest ))
116
+ block := work .Block .WithMiningResult (types . EncodeNonce ( nonce ) , common .BytesToHash (mixDigest ))
116
117
self .returnCh <- & Result {work , block }
117
118
} else {
118
119
self .returnCh <- nil
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import (
25
25
26
26
"github.com/ethereum/ethash"
27
27
"github.com/ethereum/go-ethereum/common"
28
+ "github.com/ethereum/go-ethereum/core/types"
28
29
"github.com/ethereum/go-ethereum/logger"
29
30
"github.com/ethereum/go-ethereum/logger/glog"
30
31
"github.com/ethereum/go-ethereum/pow"
@@ -132,7 +133,7 @@ func (a *RemoteAgent) GetWork() ([3]string, error) {
132
133
// SubmitWork tries to inject a PoW solution tinto the remote agent, returning
133
134
// whether the solution was acceted or not (not can be both a bad PoW as well as
134
135
// any other error, like no work pending).
135
- func (a * RemoteAgent ) SubmitWork (nonce uint64 , mixDigest , hash common.Hash ) bool {
136
+ func (a * RemoteAgent ) SubmitWork (nonce types. BlockNonce , mixDigest , hash common.Hash ) bool {
136
137
a .mu .Lock ()
137
138
defer a .mu .Unlock ()
138
139
You can’t perform that action at this time.
0 commit comments