Skip to content

Commit 77f390d

Browse files
committed
miner: add a public method to notify the inclusion list to payload
1 parent 657e027 commit 77f390d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

miner/payload_building.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ type Payload struct {
8080
requests [][]byte
8181
fullFees *big.Int
8282
stop chan struct{}
83+
inclusionList chan types.InclusionList
8384
lock sync.Mutex
8485
cond *sync.Cond
8586
}
@@ -92,6 +93,7 @@ func newPayload(empty *types.Block, emptyRequests [][]byte, witness *stateless.W
9293
emptyRequests: emptyRequests,
9394
emptyWitness: witness,
9495
stop: make(chan struct{}),
96+
inclusionList: make(chan types.InclusionList),
9597
}
9698
log.Info("Starting work on payload", "id", payload.id)
9799
payload.cond = sync.NewCond(&payload.lock)
@@ -206,6 +208,13 @@ func (payload *Payload) ResolveFull() *engine.ExecutionPayloadEnvelope {
206208
return envelope
207209
}
208210

211+
func (payload *Payload) UpdateInclusionList(inclusionList types.InclusionList) {
212+
payload.lock.Lock()
213+
defer payload.lock.Unlock()
214+
215+
payload.inclusionList <- inclusionList
216+
}
217+
209218
// buildPayload builds the payload according to the provided parameters.
210219
func (miner *Miner) buildPayload(args *BuildPayloadArgs, witness bool) (*Payload, error) {
211220
// Build the initial version with no transaction included. It should be fast
@@ -264,6 +273,8 @@ func (miner *Miner) buildPayload(args *BuildPayloadArgs, witness bool) (*Payload
264273
log.Info("Error while generating work", "id", payload.id, "err", r.err)
265274
}
266275
timer.Reset(miner.config.Recommit)
276+
case fullParams.inclusionList = <-payload.inclusionList:
277+
timer.Reset(0)
267278
case <-payload.stop:
268279
log.Info("Stopping work on payload", "id", payload.id, "reason", "delivery")
269280
return

0 commit comments

Comments
 (0)