Skip to content

Commit 58b559f

Browse files
author
MarcoFalke
committed
Merge bitcoin#20769: net: fixes bitcoin#20657 - Advertised address where nobody is listening
a381374 net: do not advertise address where nobody is listening (Jadi) Pull request description: If the bitcoind starts when listen=0 but listenonion=1, the daemon will advertise its onion address but nothing is listening for it. This update will enforce listenonion=0 when the listen is 0. ACKs for top commit: vasild: ACK a381374 jarolrod: ACK a381374 amitiuttarwar: ACK a381374 Tree-SHA512: e84a0a9a51f2217edf35d06c6cd9085d1e664452655ba92027195a1e88ba081d157310c84e9709a99ce5d46c94f231477ca2d36f010648b0c8b4f2a737d54e5d
2 parents e826b22 + a381374 commit 58b559f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/init.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,11 @@ bool AppInitParameterInteraction(const ArgsManager& args)
860860
return InitError(Untranslated("Cannot set -bind or -whitebind together with -listen=0"));
861861
}
862862

863+
// if listen=0, then disallow listenonion=1
864+
if (!args.GetBoolArg("-listen", DEFAULT_LISTEN) && args.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) {
865+
return InitError(Untranslated("Cannot set -listen=0 together with -listenonion=1"));
866+
}
867+
863868
// Make sure enough file descriptors are available
864869
int nBind = std::max(nUserBind, size_t(1));
865870
nUserMaxConnections = args.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS);

0 commit comments

Comments
 (0)