Merge pull request 'Prevent communication between HUSH3 nodes and DRAGONX nodes in both directions' (#410) from hushutils into dev

Reviewed-on: https://git.hush.is/hush/hush3/pulls/410
This commit is contained in:
duke
2024-05-22 13:11:15 +02:00

View File

@@ -1796,29 +1796,40 @@ void hush_args(char *argv0)
fprintf(stderr,".oO Starting %s Full Node (Extreme Privacy!) with genproc=%d notary=%d\n",name.c_str(),HUSH_MININGTHREADS, IS_HUSH_NOTARY); fprintf(stderr,".oO Starting %s Full Node (Extreme Privacy!) with genproc=%d notary=%d\n",name.c_str(),HUSH_MININGTHREADS, IS_HUSH_NOTARY);
vector<string> HUSH_nodes = {}; vector<string> HUSH_nodes = {};
vector<string> DRAGONX_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(name.c_str(), "HUSH3",5) == 0 ? true : false; const bool ishush3 = strncmp(name.c_str(), "HUSH3",5) == 0 ? true : false;
const bool isdragonx = strncmp(name.c_str(), "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); LogPrint("net", "%s: ishush3=%d isdragonx=%d\n", __func__, ishush3, isdragonx);
if (ishush3 || isdragonx) { if (ishush3) {
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",
"node7.hush.is","node8.hush.is","node1.hush.land", "node7.hush.is","node8.hush.is","node1.hush.land",
"node2.hush.land", "node3.hush.land", "node2.hush.land","node3.hush.land","node4.hush.land",
"node4.hush.land", "node5.hush.land"}; "node5.hush.land","node6.hush.land","node7.hush.land"};
}
if (isdragonx) {
DRAGONX_nodes = {"node1.dragonx.is","node2.dragonx.is","node3.dragonx.is",
"node4.dragonx.is","node5.dragonx.is","node6.dragonx.is"};
} }
vector<string> more_nodes = mapMultiArgs["-addnode"]; vector<string> more_nodes = mapMultiArgs["-addnode"];
if (more_nodes.size() > 0) { if (more_nodes.size() > 0) {
fprintf(stderr,"%s: Adding %lu more nodes via custom -addnode arguments\n", __func__, more_nodes.size() ); fprintf(stderr,"%s: Adding %lu more nodes via custom -addnode arguments\n", __func__, more_nodes.size() );
} }
// Add default HUSH nodes after custom addnodes, if applicable // Add default HUSH and DRAGONX 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() ); LogPrint("net", "%s: adding %d HUSH3 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() );
} }
if(DRAGONX_nodes.size() > 0) {
LogPrint("net", "%s: adding %d DRAGONX hostname-based nodes\n", __func__, DRAGONX_nodes.size() );
more_nodes.insert( more_nodes.end(), DRAGONX_nodes.begin(), DRAGONX_nodes.end() );
}
mapMultiArgs["-addnode"] = more_nodes; mapMultiArgs["-addnode"] = more_nodes;
HUSH_STOPAT = GetArg("-stopat",0); HUSH_STOPAT = GetArg("-stopat",0);
MAX_REORG_LENGTH = GetArg("-maxreorg",MAX_REORG_LENGTH); MAX_REORG_LENGTH = GetArg("-maxreorg",MAX_REORG_LENGTH);