accessman: reduce lock span by excluding ctx

This commit is contained in:
yyforyongyu committed 2025-06-18 17:19:10 +08:00
1 parent 124aabcdb7
commit d8d468f459
1 file changed
+3 -4
+3 -4
View File
@@ -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]