Browse Source

Look in /usr/share/hush for sapling params

pull/43/head
Jonathan "Duke" Leto 5 years ago
parent
commit
52c716e625
  1. 68
      src/init.cpp
  2. 2
      src/main.cpp
  3. 3
      src/net.cpp
  4. 1
      src/util.cpp

68
src/init.cpp

@ -770,7 +770,7 @@ void NoParamsShutdown(void)
uiInterface.ThreadSafeMessageBox(strprintf( uiInterface.ThreadSafeMessageBox(strprintf(
_("Cannot find the Sapling network parameters in the following directory:\n" _("Cannot find the Sapling network parameters in the following directory:\n"
"%s\n" "%s\n"
"Please run 'zcash-fetch-params' or './zcutil/fetch-params.sh' and then restart."), "Please run join our Discord for help: https://myhush.org/discord/"),
ZC_GetParamsDir()), ZC_GetParamsDir()),
"", CClientUIInterface::MSG_ERROR); "", CClientUIInterface::MSG_ERROR);
StartShutdown(); StartShutdown();
@ -781,42 +781,60 @@ static void ZC_LoadParams(
const CChainParams& chainparams const CChainParams& chainparams
) )
{ {
namespace fs = boost::filesystem;
struct timeval tv_start, tv_end; struct timeval tv_start, tv_end;
float elapsed; float elapsed;
// First check the global installation location // First check the per-user installation location
boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params"; boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params";
boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params"; boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params";
// NOTE: This means that sapling params do not need to be installed, just findable // Debian packages install globally into /usr/share/hush
if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) { if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) {
// Not globally installed, use local copies if they exist boost::filesystem::path sapling_spend = fs::path("/usr/share/hush") / "sapling-spend.params";
// First check ., then .., then ../hush3 boost::filesystem::path sapling_output = fs::path("/usr/share/hush") / "sapling-output.params";
sapling_spend = "sapling-spend.params";
sapling_output = "sapling-output.params";
// This is the most common case, for binaries distributed with params // NOTE: This means that sapling params do not need to be installed, just findable
if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) { if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) {
// Not in PWD, try .. // Not globally installed, use local copies if they exist
sapling_spend = boost::filesystem::path("..") / "sapling-spend.params"; // First check ., then .., then ../hush3
sapling_output = boost::filesystem::path("..") / "sapling-output.params"; sapling_spend = "sapling-spend.params";
sapling_output = "sapling-output.params";
// Try .. in case this binary has no params // This is the most common case, for binaries distributed with params
if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) { if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) {
// Not in .., try ../hush3 (the case of SilentDragon installed in same directory as hush3) // Not in PWD, try ..
sapling_spend = boost::filesystem::path("..") / "hush3" / "sapling-spend.params"; sapling_spend = boost::filesystem::path("..") / "sapling-spend.params";
sapling_output = boost::filesystem::path("..") / "hush3" / "sapling-output.params"; sapling_output = boost::filesystem::path("..") / "sapling-output.params";
// This will catch the case of any external software (i.e. GUI wallets) needing params and installed in same dir as hush3.git // Try .. in case this binary has no params
if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) { if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) {
// No Sapling params, at least we tried // Not in .., try ../hush3 (the case of SilentDragon installed in same directory as hush3)
NoParamsShutdown(); sapling_spend = boost::filesystem::path("..") / "hush3" / "sapling-spend.params";
return; sapling_output = boost::filesystem::path("..") / "hush3" / "sapling-output.params";
// This will catch the case of any external software (i.e. GUI wallets) needing params and installed in same dir as hush3.git
if (!( boost::filesystem::exists(sapling_spend) && boost::filesystem::exists(sapling_output))) {
// No Sapling params, at least we tried
NoParamsShutdown();
return;
} else {
fprintf(stderr,"Found sapling params in ../hush3\n");
}
} else {
fprintf(stderr,"Found sapling params in ..\n");
} }
} else {
fprintf(stderr,"Found sapling params in PWD\n");
} }
} } else {
fprintf(stderr,"Found sapling params in /usr/share/hush\n");
}
} else {
fprintf(stderr,"Found sapling params in %s\n", ZC_GetParamsDir().string().c_str() );
} }
//LogPrintf("Loading verifying key from %s\n", vk_path.string().c_str()); //LogPrintf("Loading verifying key from %s\n", vk_path.string().c_str());
gettimeofday(&tv_start, 0); gettimeofday(&tv_start, 0);
@ -870,7 +888,7 @@ bool AppInitServers(boost::thread_group& threadGroup)
return true; return true;
} }
/** Initialize bitcoin. /** Initialize Hush.
* @pre Parameters should be parsed and config file should be read. * @pre Parameters should be parsed and config file should be read.
*/ */
extern int32_t KOMODO_REWIND; extern int32_t KOMODO_REWIND;
@ -1816,10 +1834,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
InitWarning(msg); InitWarning(msg);
} }
else if (nLoadWalletRet == DB_TOO_NEW) else if (nLoadWalletRet == DB_TOO_NEW)
strErrors << _("Error loading wallet.dat: Wallet requires newer version of Komodo") << "\n"; strErrors << _("Error loading wallet.dat: Wallet requires newer version of Hush") << "\n";
else if (nLoadWalletRet == DB_NEED_REWRITE) else if (nLoadWalletRet == DB_NEED_REWRITE)
{ {
strErrors << _("Wallet needed to be rewritten: restart Zcash to complete") << "\n"; strErrors << _("Wallet needed to be rewritten: restart Hush to complete") << "\n";
LogPrintf("%s", strErrors.str()); LogPrintf("%s", strErrors.str());
return InitError(strErrors.str()); return InitError(strErrors.str());
} }
@ -1926,10 +1944,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
#ifdef ENABLE_MINING #ifdef ENABLE_MINING
#ifndef ENABLE_WALLET #ifndef ENABLE_WALLET
if (GetBoolArg("-minetolocalwallet", false)) { if (GetBoolArg("-minetolocalwallet", false)) {
return InitError(_("Zcash was not built with wallet support. Set -minetolocalwallet=0 to use -mineraddress, or rebuild Zcash with wallet support.")); return InitError(_("Hush was not built with wallet support. Set -minetolocalwallet=0 to use -mineraddress, or rebuild Hush with wallet support."));
} }
if (GetArg("-mineraddress", "").empty() && GetBoolArg("-gen", false)) { if (GetArg("-mineraddress", "").empty() && GetBoolArg("-gen", false)) {
return InitError(_("Zcash was not built with wallet support. Set -mineraddress, or rebuild Zcash with wallet support.")); return InitError(_("Hush was not built with wallet support. Set -mineraddress, or rebuild Hush with wallet support."));
} }
#endif // !ENABLE_WALLET #endif // !ENABLE_WALLET

2
src/main.cpp

@ -67,7 +67,7 @@
using namespace std; using namespace std;
#if defined(NDEBUG) #if defined(NDEBUG)
# error "Zcash cannot be compiled without assertions." # error "Hush cannot be compiled without assertions."
#endif #endif
#include "librustzcash.h" #include "librustzcash.h"

3
src/net.cpp

@ -1,5 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -1710,7 +1711,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
{ {
int nErr = WSAGetLastError(); int nErr = WSAGetLastError();
if (nErr == WSAEADDRINUSE) if (nErr == WSAEADDRINUSE)
strError = strprintf(_("Unable to bind to %s on this computer. Zcash is probably already running."), addrBind.ToString()); strError = strprintf(_("Unable to bind to %s on this computer. Hush is probably already running."), addrBind.ToString());
else else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr)); strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr));
LogPrintf("%s\n", strError); LogPrintf("%s\n", strError);

1
src/util.cpp

@ -1,5 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

Loading…
Cancel
Save