Merge branch 'dev' into duke
This commit is contained in:
6
contrib/dragonx_scanner
Executable file
6
contrib/dragonx_scanner
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2016-2024 The Hush developers
|
||||||
|
# Distributed under the GPLv3 software license, see the accompanying
|
||||||
|
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||||
|
|
||||||
|
P2PPORT=21768 RPCPORT=21769 ./hush_scanner
|
||||||
@@ -16,6 +16,13 @@ print "HOST P2P RPC\n";
|
|||||||
while (<>) {
|
while (<>) {
|
||||||
chomp;
|
chomp;
|
||||||
my $host = $_;
|
my $host = $_;
|
||||||
|
|
||||||
|
# skip empty lines
|
||||||
|
next unless $host;
|
||||||
|
|
||||||
|
# skip comment lines
|
||||||
|
next if ($host =~ m/^#/);
|
||||||
|
|
||||||
my $p2pport = $ENV{P2PPORT} || 18030;
|
my $p2pport = $ENV{P2PPORT} || 18030;
|
||||||
my $rpcport = $ENV{RPCPORT} || $p2pport + 1;
|
my $rpcport = $ENV{RPCPORT} || $p2pport + 1;
|
||||||
my $cmd1 = qq{nc -z -w2 $host $p2pport};
|
my $cmd1 = qq{nc -z -w2 $host $p2pport};
|
||||||
|
|||||||
35
contrib/hush_seed_nodes.txt
Normal file
35
contrib/hush_seed_nodes.txt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# This is a list of nodes which hushd attempts to connect to automatically
|
||||||
|
# at start up time. You can check to see if they are up/down with:
|
||||||
|
# cd contrib; cat hush_seed_nodes.txt | ./hush_scanner
|
||||||
|
|
||||||
|
# IP/tor/i2p seeds from src/chainparamsseeds.h
|
||||||
|
185.241.61.43
|
||||||
|
87.251.76.166
|
||||||
|
45.82.68.233
|
||||||
|
87.251.76.33
|
||||||
|
137.74.4.198
|
||||||
|
149.28.102.219
|
||||||
|
155.138.228.68
|
||||||
|
107.174.70.251
|
||||||
|
# hush_scanner uses nc which cannot deal with these
|
||||||
|
# 56wqzfj6mhxgsv3h3nh3pdocguogxfxud55libqjhjsdh5alfsko2iqd.onion
|
||||||
|
# hushv3h6mbxd2pptj42reko3jcexcgnz5zvp3mqcu6myto3jhhn4yzyd.onion
|
||||||
|
# hushv3xvheqh42ms3ld2nh555muscietkib7gycb7s4psbrjsysfywqd.onion
|
||||||
|
# iljqq7nnmw2ij2ezl334cerwwmgzmmbmoc3n4saditd2xhi3xohq.b32.i2p
|
||||||
|
# [2a0c:b641:6f1:34::2]
|
||||||
|
# [2a0c:b641:6f1:c::2]
|
||||||
|
|
||||||
|
# Hostname Seeds from src/hush_utils.h
|
||||||
|
node1.hush.is
|
||||||
|
node2.hush.is
|
||||||
|
node3.hush.is
|
||||||
|
node4.hush.is
|
||||||
|
node5.hush.is
|
||||||
|
node6.hush.is
|
||||||
|
node7.hush.is
|
||||||
|
node8.hush.is
|
||||||
|
node1.hush.land
|
||||||
|
node2.hush.land
|
||||||
|
node3.hush.land
|
||||||
|
node4.hush.land
|
||||||
|
node5.hush.land
|
||||||
@@ -1797,8 +1797,10 @@ void hush_args(char *argv0)
|
|||||||
|
|
||||||
vector<string> HUSH_nodes = {};
|
vector<string> HUSH_nodes = {};
|
||||||
// Only HUSH3 and DRAGONX connect to these by default, other HACs must opt-in via -connect/-addnode
|
// Only HUSH3 and DRAGONX connect to these by default, other HACs must opt-in via -connect/-addnode
|
||||||
const bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
const bool ishush3 = strncmp(name.c_str(), "HUSH3",5) == 0 ? true : false;
|
||||||
const bool isdragonx = strncmp(SMART_CHAIN_SYMBOL, "DRAGONX",7) == 0 ? true : false;
|
const bool isdragonx = strncmp(name.c_str(), "DRAGONX",7) == 0 ? true : false;
|
||||||
|
|
||||||
|
LogPrint("net", "%s: ishush3=%d isdragonx=%d\n", __func__, ishush3, isdragonx);
|
||||||
if (ishush3 || isdragonx) {
|
if (ishush3 || isdragonx) {
|
||||||
HUSH_nodes = {"node1.hush.is","node2.hush.is","node3.hush.is",
|
HUSH_nodes = {"node1.hush.is","node2.hush.is","node3.hush.is",
|
||||||
"node4.hush.is","node5.hush.is","node6.hush.is",
|
"node4.hush.is","node5.hush.is","node6.hush.is",
|
||||||
@@ -1813,6 +1815,7 @@ void hush_args(char *argv0)
|
|||||||
}
|
}
|
||||||
// Add default HUSH nodes after custom addnodes, if applicable
|
// Add default HUSH nodes after custom addnodes, if applicable
|
||||||
if(HUSH_nodes.size() > 0) {
|
if(HUSH_nodes.size() > 0) {
|
||||||
|
LogPrint("net", "%s: adding %d hostname-based nodes\n", __func__, HUSH_nodes.size() );
|
||||||
more_nodes.insert( more_nodes.end(), HUSH_nodes.begin(), HUSH_nodes.end() );
|
more_nodes.insert( more_nodes.end(), HUSH_nodes.begin(), HUSH_nodes.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
src/net.cpp
26
src/net.cpp
@@ -1690,8 +1690,8 @@ void ThreadOpenConnections()
|
|||||||
if (GetTime() - nStart > 60) {
|
if (GetTime() - nStart > 60) {
|
||||||
static bool done = false;
|
static bool done = false;
|
||||||
if (!done) {
|
if (!done) {
|
||||||
LogPrintf("Adding fixed seed nodes.\n");
|
|
||||||
std::vector<CAddress> vFixedSeeds = ConvertSeeds(Params().FixedSeeds());
|
std::vector<CAddress> vFixedSeeds = ConvertSeeds(Params().FixedSeeds());
|
||||||
|
LogPrintf("Adding %d fixed seed nodes.\n", vFixedSeeds.size());
|
||||||
BOOST_FOREACH(CAddress fixedSeed, vFixedSeeds) {
|
BOOST_FOREACH(CAddress fixedSeed, vFixedSeeds) {
|
||||||
std::vector<CAddress> vFixedSeed;
|
std::vector<CAddress> vFixedSeed;
|
||||||
vFixedSeed.push_back(fixedSeed);
|
vFixedSeed.push_back(fixedSeed);
|
||||||
@@ -1700,6 +1700,7 @@ void ThreadOpenConnections()
|
|||||||
addrman.Add(vFixedSeed, seedSource);
|
addrman.Add(vFixedSeed, seedSource);
|
||||||
}
|
}
|
||||||
done = true;
|
done = true;
|
||||||
|
LogPrintf("Done adding fixed seed nodes.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1720,6 +1721,7 @@ void ThreadOpenConnections()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LogPrint("net", "Creating %d outbound connections\n", nOutbound);
|
||||||
assert(nOutbound <= (MAX_OUTBOUND_CONNECTIONS + MAX_FEELER_CONNECTIONS));
|
assert(nOutbound <= (MAX_OUTBOUND_CONNECTIONS + MAX_FEELER_CONNECTIONS));
|
||||||
|
|
||||||
// "Feeler Connections" as per https://eprint.iacr.org/2015/263.pdf
|
// "Feeler Connections" as per https://eprint.iacr.org/2015/263.pdf
|
||||||
@@ -1751,11 +1753,14 @@ void ThreadOpenConnections()
|
|||||||
int64_t nNow = GetTime();
|
int64_t nNow = GetTime();
|
||||||
int nTries = 0;
|
int nTries = 0;
|
||||||
|
|
||||||
|
LogPrint("net", "Resolving addrman collisions\n");
|
||||||
addrman.ResolveCollisions();
|
addrman.ResolveCollisions();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (ShutdownRequested())
|
if (ShutdownRequested())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
LogPrint("net", "%s: addrman loop nTries=%d\n", __func__, nTries);
|
||||||
|
|
||||||
CAddrInfo addr = addrman.SelectTriedCollision();
|
CAddrInfo addr = addrman.SelectTriedCollision();
|
||||||
|
|
||||||
@@ -1765,17 +1770,22 @@ void ThreadOpenConnections()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we selected an invalid address, restart
|
// if we selected an invalid address, restart
|
||||||
if (!addr.IsValid() || setConnected.count(addr.GetGroup(addrman.m_asmap)) || IsLocal(addr))
|
if (!addr.IsValid() || setConnected.count(addr.GetGroup(addrman.m_asmap)) || IsLocal(addr)) {
|
||||||
|
LogPrint("net", "%s: addrman loop address is not valid, or ASN exists or is local, nTries=%d\n", __func__, nTries);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// If we didn't find an appropriate destination after trying 100 addresses fetched from addrman,
|
// If we didn't find an appropriate destination after trying 100 addresses fetched from addrman,
|
||||||
// stop this loop, and let the outer loop run again (which sleeps, adds seed nodes, recalculates
|
// stop this loop, and let the outer loop run again (which sleeps, adds seed nodes, recalculates
|
||||||
// already-connected network ranges, ...) before trying new addrman addresses.
|
// already-connected network ranges, ...) before trying new addrman addresses.
|
||||||
nTries++;
|
nTries++;
|
||||||
if (nTries > 100)
|
if (nTries > 100) {
|
||||||
|
LogPrint("net", "%s: addrman loop too many tries, nTries=%d\n", __func__, nTries);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsReachable(addr)) {
|
if (!IsReachable(addr)) {
|
||||||
|
LogPrint("net", "%s: addrman loop not reachable, nTries=%d\n", __func__, nTries);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1791,8 +1801,10 @@ void ThreadOpenConnections()
|
|||||||
|
|
||||||
//TODO: why is this a good thing?
|
//TODO: why is this a good thing?
|
||||||
// do not allow non-default ports, unless after 50 invalid addresses selected already
|
// do not allow non-default ports, unless after 50 invalid addresses selected already
|
||||||
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50)
|
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50) {
|
||||||
|
LogPrint("net", "%s: addrman loop not default port, nTries=%d\n", __func__, nTries);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
addrConnect = addr;
|
addrConnect = addr;
|
||||||
break;
|
break;
|
||||||
@@ -1892,6 +1904,7 @@ void ThreadOpenAddedConnections()
|
|||||||
// if successful, this moves the passed grant to the constructed node
|
// if successful, this moves the passed grant to the constructed node
|
||||||
bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler)
|
bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler)
|
||||||
{
|
{
|
||||||
|
LogPrint("net", "%s: %s feeler=%d oneshot=%d\n", __func__, addrConnect.ToString(), fFeeler, fOneShot);
|
||||||
// Initiate outbound network connection
|
// Initiate outbound network connection
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
if (!fNetworkActive) {
|
if (!fNetworkActive) {
|
||||||
@@ -1910,11 +1923,14 @@ bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOu
|
|||||||
} else if (FindNode(std::string(pszDest)))
|
} else if (FindNode(std::string(pszDest)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
LogPrint("net", "%s: ConnectNode(%s)\n", __func__, addrConnect.ToString());
|
||||||
CNode* pnode = ConnectNode(addrConnect, pszDest);
|
CNode* pnode = ConnectNode(addrConnect, pszDest);
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
|
|
||||||
if (!pnode)
|
if (!pnode) {
|
||||||
|
LogPrint("net", "%s: ConnectNode(%s) FAILED\n", __func__, addrConnect.ToString());
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (grantOutbound)
|
if (grantOutbound)
|
||||||
grantOutbound->MoveTo(pnode->grantOutbound);
|
grantOutbound->MoveTo(pnode->grantOutbound);
|
||||||
pnode->fNetworkNode = true;
|
pnode->fNetworkNode = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user