-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added mining for POS #3187
Added mining for POS #3187
Conversation
The Proposing process works as following:
|
ethdb/privateapi/ethbackend.go
Outdated
) *EthBackendServer { | ||
return &EthBackendServer{ctx: ctx, eth: eth, events: events, db: db, blockReader: blockReader, config: config, | ||
reverseDownloadCh: reverseDownloadCh, statusCh: statusCh, waitingForBeaconChain: waitingForBeaconChain, | ||
pendingPayloads: make(map[uint64]types2.ExecutionPayload), | ||
pendingPayloads: make(map[uint64]types2.ExecutionPayload), skipCycleHack: skipCycleHack, | ||
assemblePayloadPOS: assemblePayloadPOS, proposing: proposing, condPauseAssemble: *sync.NewCond(&sync.Mutex{}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need a separate mutex for condPauseAssemble: just re-use mu
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot do that as reusing mu, would cause mu.Lock be called multiple times without any unlocks aka. stalling everything. the reason of this is that what Wait
essentially does is locking the mutex, so we cannot reuse the same mutex. same goes with Broadcast
, which essentially unlocks the mutex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that we pass in a pointer, not just a value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've double checked https://pkg.go.dev/sync#Cond.Wait and the advise is to check for a condition in a loop. So we can use a single sync.Cond
(and its mutex) for everything, just with different checks. I've submitted 4de1c30 to that effect.
No description provided.