From 2471ce20db9fb455761ca7c495d737f7e5e9aa3c Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 9 Aug 2021 17:40:17 -0400 Subject: [PATCH 1/4] Improve handling of custom addnodes --- src/hush_utils.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hush_utils.h b/src/hush_utils.h index d7f56ea87..194a6559d 100644 --- a/src/hush_utils.h +++ b/src/hush_utils.h @@ -1810,7 +1810,14 @@ void hush_args(char *argv0) vector HUSH_nodes= {"node1.hush.is","node2.hush.is","node3.hush.is", "node4.hush.is","node5.hush.is","node6.hush.is", "node7.hush.is","node8.hush.is"}; - mapMultiArgs["-addnode"] = HUSH_nodes; + vector more_nodes = mapMultiArgs["-addnode"]; + if (more_nodes.size() > 0) { + fprintf(stderr,"Adding %d more nodes via custom -addnode arguments", more_nodes.size() ); + } + // Add default HUSH nodes after custom addnodes + more_nodes.insert( more_nodes.end(), HUSH_nodes.begin(), HUSH_nodes.end() ); + + mapMultiArgs["-addnode"] = more_nodes; HUSH_STOPAT = GetArg("-stopat",0); MAX_REORG_LENGTH = GetArg("-maxreorg",MAX_REORG_LENGTH); WITNESS_CACHE_SIZE = MAX_REORG_LENGTH+10; From c29e741109a9f1d2832f52d7f2afba7f3b28b8e8 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 9 Aug 2021 17:40:35 -0400 Subject: [PATCH 2/4] Show the actual correct config file name that cannot be found --- src/bitcoind.cpp | 2 +- src/musigtest.py | 17 ++++++++--------- src/util.cpp | 4 ++-- src/util.h | 4 ++-- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index b9dd4723b..26998168e 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -169,7 +169,7 @@ bool AppInit(int argc, char* argv[]) { fprintf(stderr, "%s reading config file\n", __FUNCTION__); ReadConfigFile(mapArgs, mapMultiArgs); - } catch (const missing_zcash_conf& e) { + } catch (const missing_hush_conf& e) { fprintf(stderr, (_("Before starting hushd, you need to create a configuration file:\n" "%s\n" diff --git a/src/musigtest.py b/src/musigtest.py index a452b7e97..9e99da51d 100755 --- a/src/musigtest.py +++ b/src/musigtest.py @@ -16,15 +16,14 @@ def def_credentials(chain): rpcport = ''; operating_system = platform.system() if operating_system == 'Darwin': - ac_dir = os.environ['HOME'] + '/Library/Application Support/Komodo' + ac_dir = os.environ['HOME'] + '/Library/Application Support/Hush' elif operating_system == 'Linux': - ac_dir = os.environ['HOME'] + '/.komodo' + ac_dir = os.environ['HOME'] + '/.hush' elif operating_system == 'Windows': - ac_dir = '%s/komodo/' % os.environ['APPDATA'] - if chain == 'KMD': - coin_config_file = str(ac_dir + '/komodo.conf') - else: - coin_config_file = str(ac_dir + '/' + chain + '/' + chain + '.conf') + ac_dir = '%s/hush/' % os.environ['APPDATA'] + + coin_config_file = str(ac_dir + '/' + chain + '/' + chain + '.conf') + with open(coin_config_file, 'r') as f: for line in f: l = line.rstrip() @@ -35,8 +34,8 @@ def def_credentials(chain): elif re.search('rpcport', l): rpcport = l.replace('rpcport=', '') if len(rpcport) == 0: - if chain == 'KMD': - rpcport = 7771 + if chain == 'HUSH3': + rpcport = 18031 else: print("rpcport not in conf file, exiting") print("check " + coin_config_file) diff --git a/src/util.cpp b/src/util.cpp index 41e346b75..a2940a0a3 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -722,14 +722,14 @@ void ReadConfigFile(map& mapSettingsRet, { boost::filesystem::ifstream streamConfig(GetConfigFile()); if (!streamConfig.good()) - throw missing_zcash_conf(); + throw missing_hush_conf(); set setOptions; setOptions.insert("*"); for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it) { - // Don't overwrite existing settings so command line settings override komodo.conf + // Don't overwrite existing settings so command line settings override HUSH3.conf string strKey = string("-") + it->string_key; if (mapSettingsRet.count(strKey) == 0) { diff --git a/src/util.h b/src/util.h index ba2feb38e..7dd63b5bb 100644 --- a/src/util.h +++ b/src/util.h @@ -145,9 +145,9 @@ boost::filesystem::path GetConfigFile(); boost::filesystem::path GetPidFile(); void CreatePidFile(const boost::filesystem::path &path, pid_t pid); #endif -class missing_zcash_conf : public std::runtime_error { +class missing_hush_conf : public std::runtime_error { public: - missing_zcash_conf() : std::runtime_error("Missing komodo.conf") { } + missing_hush_conf() : std::runtime_error(strprintf("Missing %s",GetConfigFile().string() )) { } }; void ReadConfigFile(std::map& mapSettingsRet, std::map >& mapMultiSettingsRet); #ifdef _WIN32 From d74d6d26c0216f7b5ec551dd106f12aab6e52e02 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 9 Aug 2021 17:44:27 -0400 Subject: [PATCH 3/4] . --- src/hush_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hush_utils.h b/src/hush_utils.h index 194a6559d..827203b79 100644 --- a/src/hush_utils.h +++ b/src/hush_utils.h @@ -1812,7 +1812,7 @@ void hush_args(char *argv0) "node7.hush.is","node8.hush.is"}; vector more_nodes = mapMultiArgs["-addnode"]; if (more_nodes.size() > 0) { - fprintf(stderr,"Adding %d more nodes via custom -addnode arguments", more_nodes.size() ); + fprintf(stderr,"Adding %lu more nodes via custom -addnode arguments", more_nodes.size() ); } // Add default HUSH nodes after custom addnodes more_nodes.insert( more_nodes.end(), HUSH_nodes.begin(), HUSH_nodes.end() ); From aede5cd013d7762a2d0e406dcaf18d3497bb63f6 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 9 Aug 2021 20:37:09 -0400 Subject: [PATCH 4/4] Correctly report HSC name when starting --- src/hush_utils.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hush_utils.h b/src/hush_utils.h index 827203b79..c02f14d6f 100644 --- a/src/hush_utils.h +++ b/src/hush_utils.h @@ -1792,7 +1792,10 @@ void hush_args(char *argv0) } } + name = GetArg("-ac_name","HUSH3"); + fprintf(stderr,".oO Starting %s Full Node (Extreme Privacy!) with genproc=%d notary=%d\n",name.c_str(),HUSH_MININGTHREADS, IS_HUSH_NOTARY); + if ( argv0 != 0 ) { len = (int32_t)strlen(argv0); @@ -1807,12 +1810,13 @@ void hush_args(char *argv0) } } } + vector HUSH_nodes= {"node1.hush.is","node2.hush.is","node3.hush.is", "node4.hush.is","node5.hush.is","node6.hush.is", "node7.hush.is","node8.hush.is"}; vector more_nodes = mapMultiArgs["-addnode"]; if (more_nodes.size() > 0) { - fprintf(stderr,"Adding %lu more nodes via custom -addnode arguments", 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 more_nodes.insert( more_nodes.end(), HUSH_nodes.begin(), HUSH_nodes.end() ); @@ -1830,7 +1834,6 @@ void hush_args(char *argv0) HUSH_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0); Split(GetArg("-ac_nk",""), sizeof(ASSETCHAINS_NK)/sizeof(*ASSETCHAINS_NK), ASSETCHAINS_NK, 0); - fprintf(stderr,".oO Starting HUSH Full Node (Extreme Privacy!) with genproc=%d notary=%d\n",HUSH_MININGTHREADS, IS_HUSH_NOTARY); // -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height.... Split(GetArg("-ac_ccactivateht",""), sizeof(ccEnablesHeight)/sizeof(*ccEnablesHeight), ccEnablesHeight, 0);