mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
eth/catalyst: pull feed Send out of mutex lock
This commit is contained in:
parent
4cd6aa2809
commit
bc9f01c3a5
2 changed files with 4 additions and 4 deletions
|
|
@ -54,11 +54,10 @@ type newWithdrawalsEvent struct{ Withdrawals types.Withdrawals }
|
||||||
// add queues a withdrawal for future inclusion.
|
// add queues a withdrawal for future inclusion.
|
||||||
func (w *withdrawalQueue) add(withdrawal *types.Withdrawal) error {
|
func (w *withdrawalQueue) add(withdrawal *types.Withdrawal) error {
|
||||||
w.mu.Lock()
|
w.mu.Lock()
|
||||||
defer w.mu.Unlock()
|
|
||||||
|
|
||||||
w.pending = append(w.pending, withdrawal)
|
w.pending = append(w.pending, withdrawal)
|
||||||
w.feed.Send(newWithdrawalsEvent{types.Withdrawals{withdrawal}})
|
w.mu.Unlock()
|
||||||
|
|
||||||
|
w.feed.Send(newWithdrawalsEvent{types.Withdrawals{withdrawal}})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,8 @@ func (a *simulatedBeaconAPI) loop() {
|
||||||
)
|
)
|
||||||
defer newTxsSub.Unsubscribe()
|
defer newTxsSub.Unsubscribe()
|
||||||
defer newWxsSub.Unsubscribe()
|
defer newWxsSub.Unsubscribe()
|
||||||
// a background thread which signals to the simulator when to commit
|
|
||||||
|
// A background thread which signals to the simulator when to commit
|
||||||
// based on messages over doCommit.
|
// based on messages over doCommit.
|
||||||
go func() {
|
go func() {
|
||||||
for _ = range doCommit {
|
for _ = range doCommit {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue