bool GetMyExternalIP(CNetAddr& ipRet)
{
struct sockaddr_in mapped;
- uint64_t rnd = GetRand(~0LL);
+ uint64_t rnd = ULLONG_MAX;
const char *srv;
int rc = GetExternalIPbySTUN(rnd, &mapped, &srv);
if(rc >= 0) {
{
/// when NTP implemented, change to just nTime = GetAdjustedTime()
int64_t nTime = (fInbound ? GetAdjustedTime() : GetTime());
- CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0)));
- CAddress addrMe = GetLocalAddress(&addr);
+ CAddress addrYou, addrMe;
+
+ bool fHidden = false;
+ if (addr.IsTor()) {
+ if (mapArgs.count("-torname")) {
+ // Our hidden service address
+ CService addrTorName(mapArgs["-torname"], GetListenPort());
+
+ if (addrTorName.IsValid()) {
+ addrYou = addr;
+ addrMe = CAddress(addrTorName);
+ fHidden = true;
+ }
+ }
+ }
+
+ if (!fHidden) {
+ addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0)));
+ addrMe = GetLocalAddress(&addr);
+ }
+
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str());
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
// The second name should resolve to a list of seed addresses.
static const char *strDNSSeed[][2] = {
{"novacoin.karelia.pro", "dnsseed.novacoin.karelia.pro"},
- {"novacoin.su", "dnsseed.novacoin.su"},
{"novacoin.ru", "dnsseed.novacoin.ru"},
{"novacoin.ru", "testseed.novacoin.ru"},
{"novaco.in", "dnsseed.novaco.in"},