Skip to content

Commit c89ed7e

Browse files
committed
consensus/ethash: read NotifyFull from config internally
1 parent 830e0fc commit c89ed7e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

consensus/ethash/ethash.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ func New(config Config, notify []string, noverify bool) *Ethash {
470470
update: make(chan struct{}),
471471
hashrate: metrics.NewMeterForced(),
472472
}
473-
ethash.remote = startRemoteSealer(ethash, notify, config.NotifyFull, noverify)
473+
ethash.remote = startRemoteSealer(ethash, notify, noverify)
474474
return ethash
475475
}
476476

@@ -484,7 +484,7 @@ func NewTester(notify []string, noverify bool) *Ethash {
484484
update: make(chan struct{}),
485485
hashrate: metrics.NewMeterForced(),
486486
}
487-
ethash.remote = startRemoteSealer(ethash, notify, false, noverify)
487+
ethash.remote = startRemoteSealer(ethash, notify, noverify)
488488
return ethash
489489
}
490490

consensus/ethash/sealer.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ type remoteSealer struct {
201201
ethash *Ethash
202202
noverify bool
203203
notifyURLs []string
204-
notifyFull bool
205204
results chan<- *types.Block
206205
workCh chan *sealTask // Notification channel to push new work and relative result channel to remote sealer
207206
fetchWorkCh chan *sealWork // Channel used for remote sealer to fetch mining work
@@ -242,13 +241,12 @@ type sealWork struct {
242241
res chan [4]string
243242
}
244243

245-
func startRemoteSealer(ethash *Ethash, urls []string, notifyFull bool, noverify bool) *remoteSealer {
244+
func startRemoteSealer(ethash *Ethash, urls []string, noverify bool) *remoteSealer {
246245
ctx, cancel := context.WithCancel(context.Background())
247246
s := &remoteSealer{
248247
ethash: ethash,
249248
noverify: noverify,
250249
notifyURLs: urls,
251-
notifyFull: notifyFull,
252250
notifyCtx: ctx,
253251
cancelNotify: cancel,
254252
works: make(map[common.Hash]*types.Block),
@@ -360,8 +358,11 @@ func (s *remoteSealer) makeWork(block *types.Block) {
360358
// new work to be processed.
361359
func (s *remoteSealer) notifyWork() {
362360
work := s.currentWork
361+
362+
// Encode the JSON payload of the notification. When NotifyFull is set,
363+
// this is the complete block header, otherwise it is a JSON array.
363364
var blob []byte
364-
if s.notifyFull {
365+
if s.ethash.config.NotifyFull {
365366
blob, _ = json.Marshal(s.currentBlock.Header())
366367
} else {
367368
blob, _ = json.Marshal(work)

0 commit comments

Comments
 (0)