From d8d468f4594fd3814c770dd4d6473df21c8af78b Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Sat, 31 May 2025 04:55:43 +0800 Subject: [PATCH] accessman: reduce lock span by excluding ctx --- accessman.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/accessman.go b/accessman.go index 017dcf271..996d8ad74 100644 --- a/accessman.go +++ b/accessman.go @@ -575,15 +575,14 @@ func (a *accessMan) addPeerAccess(remotePub *btcec.PublicKey, // removePeerAccess removes the peer's access from the maps. This should be // called when the peer has been disconnected. func (a *accessMan) removePeerAccess(remotePub *btcec.PublicKey) { - a.banScoreMtx.Lock() - defer a.banScoreMtx.Unlock() - ctx := btclog.WithCtx( context.TODO(), lnutils.LogPubKey("peer", remotePub), ) - acsmLog.DebugS(ctx, "Removing peer access") + a.banScoreMtx.Lock() + defer a.banScoreMtx.Unlock() + peerMapKey := string(remotePub.SerializeCompressed()) status, found := a.peerScores[peerMapKey]