refactor: use maps.Copy for cleaner map handling

Signed-off-by: xinhangzhou <shuangcui@aliyun.com>
This commit is contained in:
xinhangzhou
2025-03-24 17:13:47 +08:00
parent 5235f3b24f
commit b7e3c20383
7 changed files with 18 additions and 28 deletions

View File

@@ -2,6 +2,7 @@ package lnd
import (
"fmt"
"maps"
"sync"
"github.com/btcsuite/btcd/btcec/v2"
@@ -66,9 +67,7 @@ func newAccessMan(cfg *accessManConfig) (*accessMan, error) {
// We'll populate the server's peerCounts map with the counts fetched
// via initAccessPerms. Also note that we haven't yet connected to the
// peers.
for peerPub, count := range counts {
a.peerCounts[peerPub] = count
}
maps.Copy(a.peerCounts, counts)
return a, nil
}