mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
eth/catalyst: add peek method to payloadQueue to return Miner.Payload
This commit is contained in:
parent
8b1cf69d50
commit
4ef576d0aa
1 changed files with 16 additions and 0 deletions
|
|
@ -95,6 +95,22 @@ func (q *payloadQueue) get(id engine.PayloadID, full bool) *engine.ExecutionPayl
|
|||
return nil
|
||||
}
|
||||
|
||||
// peek retrieves a previously stored payload itself or nil if it does not exist.
|
||||
func (q *payloadQueue) peek(id engine.PayloadID) *miner.Payload {
|
||||
q.lock.RLock()
|
||||
defer q.lock.RUnlock()
|
||||
|
||||
for _, item := range q.payloads {
|
||||
if item == nil {
|
||||
return nil // no more items
|
||||
}
|
||||
if item.id == id {
|
||||
return item.payload
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// has checks if a particular payload is already tracked.
|
||||
func (q *payloadQueue) has(id engine.PayloadID) bool {
|
||||
q.lock.RLock()
|
||||
|
|
|
|||
Loading…
Reference in a new issue