accessman+lnd: rename checkIncomingConnBanScore for clarity
This commit is contained in:
3 files changed
+6
-6
No files matched your search
+3
-3
@@ -481,15 +481,15 @@ func (a *accessMan) newOpenChan(remotePub *btcec.PublicKey) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkIncomingConnBanScore checks whether, given the remote's public hex-
|
// checkAcceptIncomingConn checks whether, given the remote's public hex-
|
||||||
// encoded key, we should not accept this incoming connection or immediately
|
// encoded key, we should not accept this incoming connection or immediately
|
||||||
// disconnect. This does not assign to the server's peerScores maps. This is
|
// disconnect. This does not assign to the server's peerScores maps. This is
|
||||||
// just an inbound filter that the brontide listeners use.
|
// just an inbound filter that the brontide listeners use.
|
||||||
//
|
//
|
||||||
// TODO(yy): We should also consider removing this `checkIncomingConnBanScore`
|
// TODO(yy): We should also consider removing this `checkAcceptIncomingConn`
|
||||||
// check as a) it doesn't check for ban score; and b) we should, and already
|
// check as a) it doesn't check for ban score; and b) we should, and already
|
||||||
// have this check when we handle incoming connection in `InboundPeerConnected`.
|
// have this check when we handle incoming connection in `InboundPeerConnected`.
|
||||||
func (a *accessMan) checkIncomingConnBanScore(remotePub *btcec.PublicKey) (
|
func (a *accessMan) checkAcceptIncomingConn(remotePub *btcec.PublicKey) (
|
||||||
bool, error) {
|
bool, error) {
|
||||||
|
|
||||||
ctx := btclog.WithCtx(
|
ctx := btclog.WithCtx(
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,7 @@ func assertInboundConnection(t *testing.T, a *accessMan,
|
|||||||
|
|
||||||
remotePubSer := string(remotePub.SerializeCompressed())
|
remotePubSer := string(remotePub.SerializeCompressed())
|
||||||
|
|
||||||
isSlotAvailable, err := a.checkIncomingConnBanScore(remotePub)
|
isSlotAvailable, err := a.checkAcceptIncomingConn(remotePub)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.True(t, isSlotAvailable)
|
require.True(t, isSlotAvailable)
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ func TestAccessManRestrictedSlots(t *testing.T) {
|
|||||||
peerKey4 := peerPriv4.PubKey()
|
peerKey4 := peerPriv4.PubKey()
|
||||||
|
|
||||||
// Follow the normal process of an incoming connection. We check if we
|
// Follow the normal process of an incoming connection. We check if we
|
||||||
// can accommodate this peer in checkIncomingConnBanScore and then we
|
// can accommodate this peer in checkAcceptIncomingConn and then we
|
||||||
// assign its access permissions and then insert into the map.
|
// assign its access permissions and then insert into the map.
|
||||||
assertInboundConnection(t, a, peerKey4, peerStatusRestricted)
|
assertInboundConnection(t, a, peerKey4, peerStatusRestricted)
|
||||||
|
|
||||||
|
|||||||
@@ -1908,7 +1908,7 @@ func newServer(_ context.Context, cfg *Config, listenAddrs []net.Addr,
|
|||||||
nodeKeyECDH, listenAddr.String(),
|
nodeKeyECDH, listenAddr.String(),
|
||||||
// TODO(yy): remove this check and unify the inbound
|
// TODO(yy): remove this check and unify the inbound
|
||||||
// connection check inside `InboundPeerConnected`.
|
// connection check inside `InboundPeerConnected`.
|
||||||
s.peerAccessMan.checkIncomingConnBanScore,
|
s.peerAccessMan.checkAcceptIncomingConn,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in new issue
Block a user