Skip to content

Commit

Permalink
Merge #2682: [net] Remove assert(nMaxInbound > 0)
Browse files Browse the repository at this point in the history
72dfebb [net] Remove assert(nMaxInbound > 0) (MarcoFalke)

Pull request description:

  Backports bitcoin#9008.

  > nMaxInbound might very well be 0 or -1, if the user prefers to keep a small number of maxconnections.
  >
  > Note: nMaxInbound of -1 means that the user set maxconnections
  to 8 or less, but we still want to keep an additional slot for
  the feeler connection.

  Have faced this assertion crash few times in testnet already.

ACKs for top commit:
  Fuzzbawls:
    utACK 72dfebb
  random-zebra:
    utACK 72dfebb

Tree-SHA512: 3e926e9c44cd9fbc6bcbd5112467c7d6bed38b47abdd866382f552f0c52ea1a7c6c36293a0dd6aea08a42ae7970085e5ed5f0d039d912e384f47e3499418a546
  • Loading branch information
random-zebra committed Dec 14, 2021
2 parents 4645a54 + 72dfebb commit c394b41
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,6 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
CAddress addr;
int nInbound = 0;
int nMaxInbound = nMaxConnections - (nMaxOutbound + nMaxFeeler);
assert(nMaxInbound > 0);

if (hSocket != INVALID_SOCKET)
if (!addr.SetSockAddr((const struct sockaddr*)&sockaddr))
Expand Down

0 comments on commit c394b41

Please sign in to comment.