From bc9f01c3a53c870ece8830a3da4e08bffb788d40 Mon Sep 17 00:00:00 2001 From: lightclient Date: Mon, 19 Aug 2024 07:18:31 -0600 Subject: [PATCH] eth/catalyst: pull feed Send out of mutex lock --- eth/catalyst/simulated_beacon.go | 5 ++--- eth/catalyst/simulated_beacon_api.go | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index de6ab8e6bd..86355a1533 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -54,11 +54,10 @@ type newWithdrawalsEvent struct{ Withdrawals types.Withdrawals } // add queues a withdrawal for future inclusion. func (w *withdrawalQueue) add(withdrawal *types.Withdrawal) error { w.mu.Lock() - defer w.mu.Unlock() - 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 } diff --git a/eth/catalyst/simulated_beacon_api.go b/eth/catalyst/simulated_beacon_api.go index da95be18d3..79a0121b5b 100644 --- a/eth/catalyst/simulated_beacon_api.go +++ b/eth/catalyst/simulated_beacon_api.go @@ -54,7 +54,8 @@ func (a *simulatedBeaconAPI) loop() { ) defer newTxsSub.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. go func() { for _ = range doCommit {