accessman: reduce lock span by excluding ctx
This commit is contained in:
1 file changed
+3
-4
+3
-4
@@ -575,15 +575,14 @@ func (a *accessMan) addPeerAccess(remotePub *btcec.PublicKey,
|
|||||||
// removePeerAccess removes the peer's access from the maps. This should be
|
// removePeerAccess removes the peer's access from the maps. This should be
|
||||||
// called when the peer has been disconnected.
|
// called when the peer has been disconnected.
|
||||||
func (a *accessMan) removePeerAccess(remotePub *btcec.PublicKey) {
|
func (a *accessMan) removePeerAccess(remotePub *btcec.PublicKey) {
|
||||||
a.banScoreMtx.Lock()
|
|
||||||
defer a.banScoreMtx.Unlock()
|
|
||||||
|
|
||||||
ctx := btclog.WithCtx(
|
ctx := btclog.WithCtx(
|
||||||
context.TODO(), lnutils.LogPubKey("peer", remotePub),
|
context.TODO(), lnutils.LogPubKey("peer", remotePub),
|
||||||
)
|
)
|
||||||
|
|
||||||
acsmLog.DebugS(ctx, "Removing peer access")
|
acsmLog.DebugS(ctx, "Removing peer access")
|
||||||
|
|
||||||
|
a.banScoreMtx.Lock()
|
||||||
|
defer a.banScoreMtx.Unlock()
|
||||||
|
|
||||||
peerMapKey := string(remotePub.SerializeCompressed())
|
peerMapKey := string(remotePub.SerializeCompressed())
|
||||||
|
|
||||||
status, found := a.peerScores[peerMapKey]
|
status, found := a.peerScores[peerMapKey]
|
||||||
|
|||||||
Reference in new issue
Block a user