From d62d38312f2a84180892a9a0f321648babe09d73 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 11 Jul 2021 19:03:02 -0400 Subject: [PATCH] Cleanup and make all custom hushd settings defaults for HUSH3 mainnet --- src/hush_utils.h | 28 +++++++++++++++++++--------- src/init.cpp | 8 ++++---- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/hush_utils.h b/src/hush_utils.h index de616fdb5..09c0e0e8a 100644 --- a/src/hush_utils.h +++ b/src/hush_utils.h @@ -1761,12 +1761,6 @@ void hush_args(char *argv0) { HUSH_MININGTHREADS = GetArg("-genproclimit",-1); } - if ( (GetBoolArg("-exchange", false)) != 0 ) { - printf("The KMD-only feature -exchange is not supported by HUSH!\n"); - printf("jl777 uses this \"feature\" to steal from his own users!\n"); - printf("Learn more at https://duke.hush.is :)\n"); - StartShutdown(); - } DONATION_PUBKEY = GetArg("-donation", ""); NOTARY_PUBKEY = GetArg("-pubkey", ""); HUSH_DEALERNODE = GetArg("-dealer",0); @@ -1813,7 +1807,7 @@ void hush_args(char *argv0) HUSH_STOPAT = GetArg("-stopat",0); MAX_REORG_LENGTH = GetArg("-maxreorg",MAX_REORG_LENGTH); WITNESS_CACHE_SIZE = MAX_REORG_LENGTH+10; - ASSETCHAINS_CC = GetArg("-ac_cc",2); + ASSETCHAINS_CC = GetArg("-ac_cc",0); HUSH_CCACTIVATE = GetArg("-ac_ccactivate",0); ASSETCHAINS_BLOCKTIME = GetArg("-ac_blocktime",60); ASSETCHAINS_PUBLIC = 0; @@ -1908,6 +1902,20 @@ void hush_args(char *argv0) if(ishush3) { fprintf(stderr,"%s: Setting custom HUSH3 reward,halving,subsidy chain values...\n",__func__); + // Migrated from hushd script + ASSETCHAINS_CC = 2; + ASSETCHAINS_BLOCKTIME = 75; + ASSETCHAINS_LASTERA = 3; + ASSETCHAINS_COMMISSION = 11111111; + // 6250000 - (Sprout pool at block 500,000) + ASSETCHAINS_SUPPLY = 6178674; + ASSETCHAINS_FOUNDERS = 1; + // this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn + ASSETCHAINS_SCRIPTPUB = "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac"; + + Split("128,340000,5422111" , sizeof(ASSETCHAINS_ENDSUBSIDY)/sizeof(*ASSETCHAINS_ENDSUBSIDY), ASSETCHAINS_ENDSUBSIDY, 0); + Split("129,340000,840000", sizeof(ASSETCHAINS_HALVING)/sizeof(*ASSETCHAINS_HALVING), ASSETCHAINS_HALVING, 0); + Split("0,1125000000,562500000" , sizeof(ASSETCHAINS_REWARD)/sizeof(*ASSETCHAINS_REWARD), ASSETCHAINS_REWARD, 0); // Over-ride HUSH3 values from CLI params. Changing our blocktime to 75s changes things ASSETCHAINS_REWARD[0] = 0; ASSETCHAINS_REWARD[1] = 1125000000; @@ -1992,8 +2000,10 @@ void hush_args(char *argv0) if ( ASSETCHAINS_CC != 0 ) { uint8_t prevCCi = 0; - ASSETCHAINS_CCLIB = GetArg("-ac_cclib",""); - Split(GetArg("-ac_ccenable",""), sizeof(ccenables)/sizeof(*ccenables), ccenables, 0); + ASSETCHAINS_CCLIB = GetArg("-ac_cclib","hush3"); + + // these are the enabled CCs on HUSH3 mainnet + Split(GetArg("-ac_ccenable","228,234,235,236,241"), sizeof(ccenables)/sizeof(*ccenables), ccenables, 0); for (i=nonz=0; i<0x100; i++) { if ( ccenables[i] != prevCCi && ccenables[i] != 0 ) diff --git a/src/init.cpp b/src/init.cpp index 163df8a39..3e699a7cf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -412,7 +412,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-zindex", strprintf(_("Maintain extra statistics about shielded transactions and payments (default: %u)"), 0)); strUsage += HelpMessageGroup(_("Connection options:")); strUsage += HelpMessageOpt("-addnode=", _("Add a node to connect to and attempt to keep the connection open")); - strUsage += HelpMessageOpt("-asmap=", strprintf("Specify asn mapping used for bucketing of the peers (default: %s). Relative paths will be prefixed by the net-specific datadir location.", DEFAULT_ASMAP_FILENAME)); + strUsage += HelpMessageOpt("-asmap=", strprintf("Specify ASN mapping used for bucketing of the peers (default: %s). Relative paths will be prefixed by the net-specific datadir location.", DEFAULT_ASMAP_FILENAME)); strUsage += HelpMessageOpt("-banscore=", strprintf(_("Threshold for disconnecting misbehaving peers (default: %u)"), 100)); strUsage += HelpMessageOpt("-bantime=", strprintf(_("Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), 86400)); strUsage += HelpMessageOpt("-bind=", _("Bind to given address and always listen on it. Use [host]:port notation for IPv6")); @@ -1092,8 +1092,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("%s: parameter interaction: -externalip set -> setting -discover=0\n", __func__); } - // Read asmap file if configured - if (mapArgs.count("-asmap")) { + // Read asmap file by default for HUSH3 and all Hush Smart Chains + if (GetArg("-asmap",1)) { fs::path asmap_path = fs::path(GetArg("-asmap", "")); char cwd[1024]; @@ -1577,7 +1577,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) return InitError(strprintf("User Agent comment (%s) contains unsafe characters.", cmt)); uacomments.push_back(SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)); } - strSubVersion = FormatSubVersion(GetArg("-clientname","jl777sRemorse"), CLIENT_VERSION, uacomments); + strSubVersion = FormatSubVersion(GetArg("-clientname","GoldenSandrout"), CLIENT_VERSION, uacomments); if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) { return InitError(strprintf("Total length of network version string %i exceeds maximum of %i characters. Reduce the number and/or size of uacomments.", strSubVersion.size(), MAX_SUBVERSION_LENGTH));