eth/catalyst, miner: deduplicate work + show payload id (#26115)
This PR now also includes a fix to the problem of mult-routines building blocks on the same input. This PR works as before with regards to stopping the work, but it just will not spin up a second routine if one is already building. So if the CL does N calls to FCU+buildblock, and N calls to GetPayload, only the first of each will do something, the other calls will be mostly no-ops. This PR also adds printout of the payload id into the logs.
This commit is contained in:
@@ -85,6 +85,22 @@ func (q *payloadQueue) get(id beacon.PayloadID) *beacon.ExecutableDataV1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// has checks if a particular payload is already tracked.
|
||||
func (q *payloadQueue) has(id beacon.PayloadID) bool {
|
||||
q.lock.RLock()
|
||||
defer q.lock.RUnlock()
|
||||
|
||||
for _, item := range q.payloads {
|
||||
if item == nil {
|
||||
return false
|
||||
}
|
||||
if item.id == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// headerQueueItem represents an hash->header tuple to store until it's retrieved
|
||||
// or evicted.
|
||||
type headerQueueItem struct {
|
||||
|
||||
Reference in New Issue
Block a user