Fix lots of little things that were undone by migrating Hush to KMD source code

This commit is contained in:
Duke Leto
2019-10-25 10:17:30 -04:00
parent 3a7db19af4
commit b00cda1c09
10 changed files with 59 additions and 35 deletions

View File

@@ -16,14 +16,14 @@ BEGIN
BEGIN
BLOCK "040904E4" // U.S. English - multilingual (hex)
BEGIN
VALUE "CompanyName", "Zcash"
VALUE "FileDescription", "zcash-tx (CLI Zcash transaction editor utility)"
VALUE "CompanyName", "Hush"
VALUE "FileDescription", "hush-tx (CLI Zcash transaction editor utility)"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "zcash-tx"
VALUE "InternalName", "hush-tx"
VALUE "LegalCopyright", COPYRIGHT_STR
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
VALUE "OriginalFilename", "zcash-tx.exe"
VALUE "ProductName", "zcash-tx"
VALUE "OriginalFilename", "hush-tx.exe"
VALUE "ProductName", "hush-tx"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

View File

@@ -1,5 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -70,12 +71,17 @@ CBlockIndex *komodo_chainactive(int32_t height);
void WaitForShutdown(boost::thread_group* threadGroup)
{
int32_t i,height; CBlockIndex *pindex; bool fShutdown = ShutdownRequested(); const uint256 zeroid;
fprintf(stderr,"%s: fShutdown=%d, KOMODO_EARLYTXID_HEIGHT=%d\n", __FUNCTION__, fShutdown, KOMODO_EARLYTXID_HEIGHT);
// Tell the main threads to shutdown.
if (komodo_currentheight()>KOMODO_EARLYTXID_HEIGHT && KOMODO_EARLYTXID!=zeroid && ((height=tx_height(KOMODO_EARLYTXID))==0 || height>KOMODO_EARLYTXID_HEIGHT))
{
fprintf(stderr,"error: earlytx must be before block height %d or tx does not exist\n",KOMODO_EARLYTXID_HEIGHT);
StartShutdown();
}
fprintf(stderr,"%s: earlytx height=%d, ASSETCHAINS_CBOPRET=%li\n", __FUNCTION__, height, ASSETCHAINS_CBOPRET);
/*if ( ASSETCHAINS_STAKED == 0 && ASSETCHAINS_ADAPTIVEPOW == 0 && (pindex= komodo_chainactive(1)) != 0 )
{
if ( pindex->nTime > ADAPTIVEPOW_CHANGETO_DEFAULTON )
@@ -84,11 +90,14 @@ void WaitForShutdown(boost::thread_group* threadGroup)
fprintf(stderr,"default activate adaptivepow\n");
} else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,ADAPTIVEPOW_CHANGETO_DEFAULTON);
} //else fprintf(stderr,"cant find height 1\n");*/
if ( ASSETCHAINS_CBOPRET != 0 )
if ( ASSETCHAINS_CBOPRET != 0 ) {
komodo_pricesinit();
}
while (!fShutdown)
{
//fprintf(stderr,"call passport iteration\n");
fprintf(stderr,"call passport iteration\n");
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
if ( KOMODO_NSPV_FULLNODE )
@@ -100,9 +109,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
break;
MilliSleep(1000);
}
}
else
{
} else {
//komodo_interestsum();
//komodo_longestchain();
if ( ASSETCHAINS_CBOPRET != 0 )
@@ -117,6 +124,8 @@ void WaitForShutdown(boost::thread_group* threadGroup)
}
fShutdown = ShutdownRequested();
}
fprintf(stderr,"%s: fShutdown=%d\n", __FUNCTION__, fShutdown);
if (threadGroup)
{
Interrupt(*threadGroup);
@@ -141,6 +150,8 @@ bool AppInit(int argc, char* argv[])
bool fRet = false;
fprintf(stderr, "%s start, argc=%d\n", __FUNCTION__, argc);
//
// Parameters
//
@@ -189,6 +200,7 @@ bool AppInit(int argc, char* argv[])
}
try
{
fprintf(stderr, "%s reading config file\n", __FUNCTION__);
ReadConfigFile(mapArgs, mapMultiArgs);
} catch (const missing_zcash_conf& e) {
fprintf(stderr,
@@ -216,9 +228,12 @@ bool AppInit(int argc, char* argv[])
// Command-line RPC
bool fCommandLine = false;
for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "komodo:"))
for (int i = 1; i < argc; i++) {
//TODO: should this be hush: or komodo: ??
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "komodo:")) {
fCommandLine = true;
}
}
if (fCommandLine)
{
@@ -252,20 +267,23 @@ bool AppInit(int argc, char* argv[])
#endif
SoftSetBoolArg("-server", true);
fprintf(stderr,"%s: Running AppInit2()\n", __FUNCTION__);
fRet = AppInit2(threadGroup, scheduler);
}
catch (const std::exception& e) {
fprintf(stderr,"%s: Finished AppInit2(), fRet=%d\n", __FUNCTION__, fRet);
} catch (const std::exception& e) {
PrintExceptionContinue(&e, "AppInit()");
} catch (...) {
PrintExceptionContinue(NULL, "AppInit()");
}
if (!fRet)
{
fprintf(stderr,"%s: Interrupting threadGroup\n", __FUNCTION__);
Interrupt(threadGroup);
// threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of
// the startup-failure cases to make sure they don't result in a hang due to some
// thread-blocking-waiting-for-another-thread-during-startup case
} else {
fprintf(stderr,"%s: Waiting for Shutdown\n", __FUNCTION__);
WaitForShutdown(&threadGroup);
}
Shutdown();

View File

@@ -306,7 +306,7 @@ static void http_reject_request_cb(struct evhttp_request* req, void*)
/** Event dispatcher thread */
static void ThreadHTTP(struct event_base* base, struct evhttp* http)
{
RenameThread("zcash-http");
RenameThread("hush-http");
LogPrint("http", "Entering http event loop\n");
event_base_dispatch(base);
// Event loop will be interrupted by InterruptHTTPServer()
@@ -355,7 +355,7 @@ static bool HTTPBindAddresses(struct evhttp* http)
/** Simple wrapper to set thread name and run work queue */
static void HTTPWorkQueueRun(WorkQueue<HTTPClosure>* queue)
{
RenameThread("zcash-httpworker");
RenameThread("hush-httpworker");
queue->Run();
}

View File

@@ -219,7 +219,6 @@ void Shutdown()
/// module was initialized.
static char shutoffstr[128];
sprintf(shutoffstr,"%s-shutoff",ASSETCHAINS_SYMBOL);
//RenameThread("verus-shutoff");
RenameThread(shutoffstr);
mempool.AddTransactionsUpdated(1);
@@ -674,7 +673,7 @@ void CleanupBlockRevFiles()
void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
{
RenameThread("zcash-loadblk");
RenameThread("hush-loadblk");
// -reindex
if (fReindex) {
CImportingNow imp;

View File

@@ -1,5 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -3352,7 +3353,7 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne
static CCheckQueue<CScriptCheck> scriptcheckqueue(128);
void ThreadScriptCheck() {
RenameThread("zcash-scriptch");
RenameThread("hush-scriptch");
scriptcheckqueue.Thread();
}
@@ -4260,6 +4261,7 @@ static int64_t nTimePostConnect = 0;
*/
bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *pblock) {
fprintf(stderr, "%s: Start\n", __FUNCTION__);
assert(pindexNew->pprev == chainActive.Tip());
// Read block from disk.
int64_t nTime1 = GetTimeMicros();
@@ -4270,7 +4272,8 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
pblock = &block;
}
KOMODO_CONNECTING = (int32_t)pindexNew->GetHeight();
//fprintf(stderr,"%s connecting ht.%d maxsize.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pindexNew->GetHeight(),MAX_BLOCK_SIZE(pindexNew->GetHeight()),(int32_t)::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
fprintf(stderr,"%s connecting ht.%d maxsize.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pindexNew->GetHeight(),MAX_BLOCK_SIZE(pindexNew->GetHeight()),(int32_t)::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
// Get the current commitment tree
SproutMerkleTree oldSproutTree;
SaplingMerkleTree oldSaplingTree;
@@ -4348,7 +4351,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
if ( KOMODO_LONGESTCHAIN != 0 && (pindexNew->GetHeight() == KOMODO_LONGESTCHAIN || pindexNew->GetHeight() == KOMODO_LONGESTCHAIN+1) )
KOMODO_INSYNC = (int32_t)pindexNew->GetHeight();
else KOMODO_INSYNC = 0;
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
/*if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
komodo_broadcast(pblock,8);
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
@@ -4448,6 +4451,7 @@ static void PruneBlockIndexCandidates() {
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork.
*/
static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBlockIndex *pindexMostWork, CBlock *pblock) {
fprintf(stderr,"%s: fSkipdpow=%d\n", __FUNCTION__, fSkipdpow);
AssertLockHeld(cs_main);
bool fInvalidFound = false;
const CBlockIndex *pindexOldTip = chainActive.Tip();
@@ -4583,6 +4587,7 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc
* that is already loaded (to avoid loading it again from disk).
*/
bool ActivateBestChain(bool fSkipdpow, CValidationState &state, CBlock *pblock) {
fprintf(stderr,"%s: fSkipdpow=%d\n", __FUNCTION__, fSkipdpow);
CBlockIndex *pindexNewTip = NULL;
CBlockIndex *pindexMostWork = NULL;
const CChainParams& chainParams = Params();

View File

@@ -1,4 +1,5 @@
// Copyright (c) 2016 The Zcash developers
// Copyright (c) 2019 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -298,7 +299,7 @@ int printMiningStatus(bool mining)
lines++;
} else {
std::cout << _("You are currently not mining.") << std::endl;
std::cout << _("To enable mining, add 'gen=1' to your zcash.conf and restart.") << std::endl;
std::cout << _("To enable mining, add 'gen=1' to your HUSH3.conf and restart.") << std::endl;
lines += 2;
}
std::cout << std::endl;
@@ -479,7 +480,7 @@ bool enableVTMode()
void ThreadShowMetricsScreen()
{
// Make this thread recognisable as the metrics screen thread
RenameThread("zcash-metrics-screen");
RenameThread("hush-metrics-screen");
// Determine whether we should render a persistent UI or rolling metrics
bool isTTY = isatty(STDOUT_FILENO);
@@ -499,8 +500,8 @@ void ThreadShowMetricsScreen()
std::cout << std::endl;
// Thank you text
std::cout << _("Thank you for running a Zcash node!") << std::endl;
std::cout << _("You're helping to strengthen the network and contributing to a social good :)") << std::endl;
std::cout << _("Thank you for running a Hush node!") << std::endl;
std::cout << _("You are helping secure the network and others Speak And Transact Freely!") << std::endl;
// Privacy notice text
std::cout << PrivacyInfo();
@@ -552,7 +553,7 @@ void ThreadShowMetricsScreen()
// Explain how to exit
std::cout << "[";
#ifdef WIN32
std::cout << _("'zcash-cli.exe stop' to exit");
std::cout << _("'hush-cli.exe stop' to exit");
#else
std::cout << _("Press Ctrl+C to exit");
#endif

View File

@@ -539,10 +539,10 @@ boost::filesystem::path GetDefaultDataDir()
if ( ASSETCHAINS_SYMBOL[0] != 0 )
strcpy(symbol,ASSETCHAINS_SYMBOL);
else symbol[0] = 0;
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Zcash
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Zcash
// Mac: ~/Library/Application Support/Zcash
// Unix: ~/.zcash
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Komodo
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Komodo
// Mac: ~/Library/Application Support/Komodo
// Unix: ~/.komodo
#ifdef _WIN32
// Windows
if ( symbol[0] == 0 )
@@ -589,6 +589,7 @@ static boost::filesystem::path ZC_GetBaseParamsDir()
// Windows >= Vista: C:\Users\Username\AppData\Roaming\ZcashParams
// Mac: ~/Library/Application Support/ZcashParams
// Unix: ~/.zcash-params
// Debian packages: /usr/share/hush
fs::path pathRet;
#ifdef _WIN32
return GetSpecialFolderPath(CSIDL_APPDATA) / "ZcashParams";

View File

@@ -264,7 +264,7 @@ void RenameThread(const char* name);
*/
template <typename Callable> void TraceThread(const char* name, Callable func)
{
std::string s = strprintf("zcash-%s", name);
std::string s = strprintf("hush-%s", name);
RenameThread(s.c_str());
try
{

View File

@@ -1115,7 +1115,7 @@ DBErrors CWalletDB::ZapWalletTx(CWallet* pwallet, vector<CWalletTx>& vWtx)
void ThreadFlushWalletDB(const string& strFile)
{
// Make this thread recognisable as the wallet flushing thread
RenameThread("zcash-wallet");
RenameThread("hush-wallet");
static bool fOneThread;
if (fOneThread)