die if we are a relay and don't have any inbound links

This commit is contained in:
Jeff Becker 2020-08-14 11:36:08 -04:00
parent 8c3621cead
commit ff130e2b5e
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
3 changed files with 9 additions and 5 deletions

View File

@ -143,6 +143,7 @@ namespace llarp
else
{
m_enablePeerStats = true;
m_isRelay = true;
}
}

View File

@ -63,6 +63,7 @@ namespace llarp
std::string m_transportKeyFile;
bool m_enablePeerStats = false;
bool m_isRelay = false;
void
defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params);

View File

@ -449,11 +449,7 @@ namespace llarp
if (usingSNSeed)
ident_keyfile = conf.lokid.ident_keyfile;
// TODO: add config flag for "is service node"
if (conf.links.m_InboundLinks.size())
{
m_isServiceNode = true;
}
m_isServiceNode = conf.router.m_isRelay;
networkConfig = conf.network;
@ -966,6 +962,12 @@ namespace llarp
}
});
if (IsServiceNode() and not _rc.IsPublicRouter())
{
LogError("we are configured as relay but have no reachable addresses");
return false;
}
// set public encryption key
_rc.enckey = seckey_topublic(encryption());