mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
miner: add a public method to notify the inclusion list to payload
This commit is contained in:
parent
526baf20fd
commit
8b1cf69d50
1 changed files with 11 additions and 0 deletions
|
|
@ -80,6 +80,7 @@ type Payload struct {
|
||||||
requests [][]byte
|
requests [][]byte
|
||||||
fullFees *big.Int
|
fullFees *big.Int
|
||||||
stop chan struct{}
|
stop chan struct{}
|
||||||
|
inclusionList chan types.InclusionList
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
cond *sync.Cond
|
cond *sync.Cond
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +93,7 @@ func newPayload(empty *types.Block, emptyRequests [][]byte, witness *stateless.W
|
||||||
emptyRequests: emptyRequests,
|
emptyRequests: emptyRequests,
|
||||||
emptyWitness: witness,
|
emptyWitness: witness,
|
||||||
stop: make(chan struct{}),
|
stop: make(chan struct{}),
|
||||||
|
inclusionList: make(chan types.InclusionList),
|
||||||
}
|
}
|
||||||
log.Info("Starting work on payload", "id", payload.id)
|
log.Info("Starting work on payload", "id", payload.id)
|
||||||
payload.cond = sync.NewCond(&payload.lock)
|
payload.cond = sync.NewCond(&payload.lock)
|
||||||
|
|
@ -206,6 +208,13 @@ func (payload *Payload) ResolveFull() *engine.ExecutionPayloadEnvelope {
|
||||||
return envelope
|
return envelope
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (payload *Payload) UpdateInclusionList(inclusionList types.InclusionList) {
|
||||||
|
payload.lock.Lock()
|
||||||
|
defer payload.lock.Unlock()
|
||||||
|
|
||||||
|
payload.inclusionList <- inclusionList
|
||||||
|
}
|
||||||
|
|
||||||
// buildPayload builds the payload according to the provided parameters.
|
// buildPayload builds the payload according to the provided parameters.
|
||||||
func (miner *Miner) buildPayload(args *BuildPayloadArgs, witness bool) (*Payload, error) {
|
func (miner *Miner) buildPayload(args *BuildPayloadArgs, witness bool) (*Payload, error) {
|
||||||
// Build the initial version with no transaction included. It should be fast
|
// 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
|
||||||
log.Info("Error while generating work", "id", payload.id, "err", r.err)
|
log.Info("Error while generating work", "id", payload.id, "err", r.err)
|
||||||
}
|
}
|
||||||
timer.Reset(miner.config.Recommit)
|
timer.Reset(miner.config.Recommit)
|
||||||
|
case fullParams.inclusionList = <-payload.inclusionList:
|
||||||
|
timer.Reset(0)
|
||||||
case <-payload.stop:
|
case <-payload.stop:
|
||||||
log.Info("Stopping work on payload", "id", payload.id, "reason", "delivery")
|
log.Info("Stopping work on payload", "id", payload.id, "reason", "delivery")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue