Merge pull request #9880 from yyforyongyu/accessman

Improve access control in peer connections
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2025-06-20 15:26:24 -07:00
commit faa68a220e
15 files changed
+1104 -305

No files matched your search

+7 -7
View File
@@ -743,7 +743,7 @@ type ChanCount struct {
func (c *ChannelStateDB) FetchPermAndTempPeers(
chainHash []byte) (map[string]ChanCount, error) {
peerCounts := make(map[string]ChanCount)
peerChanInfo := make(map[string]ChanCount)
err := kvdb.View(c.backend, func(tx kvdb.RTx) error {
openChanBucket := tx.ReadBucket(openChannelBucket)
@@ -829,7 +829,7 @@ func (c *ChannelStateDB) FetchPermAndTempPeers(
HasOpenOrClosedChan: isPermPeer,
PendingOpenCount: pendingOpenCount,
}
peerCounts[string(nodePub)] = peerCount
peerChanInfo[string(nodePub)] = peerCount
return nil
})
@@ -893,15 +893,15 @@ func (c *ChannelStateDB) FetchPermAndTempPeers(
remoteSer := remotePub.SerializeCompressed()
remoteKey := string(remoteSer)
count, exists := peerCounts[remoteKey]
count, exists := peerChanInfo[remoteKey]
if exists {
count.HasOpenOrClosedChan = true
peerCounts[remoteKey] = count
peerChanInfo[remoteKey] = count
} else {
peerCount := ChanCount{
HasOpenOrClosedChan: true,
}
peerCounts[remoteKey] = peerCount
peerChanInfo[remoteKey] = peerCount
}
}
@@ -913,10 +913,10 @@ func (c *ChannelStateDB) FetchPermAndTempPeers(
return nil
}, func() {
clear(peerCounts)
clear(peerChanInfo)
})
return peerCounts, err
return peerChanInfo, err
}
// channelSelector describes a function that takes a chain-hash bucket from