dynamic coin name

This commit is contained in:
Andre Jochems
2016-04-06 14:56:42 +02:00
parent 2e0aaa5022
commit 56bf480259
28 changed files with 180 additions and 171 deletions

View File

@@ -1,6 +1,5 @@
TEMPLATE = app TEMPLATE = app
TARGET = casinocoin-qt TARGET = casinocoin-qt
macx:TARGET = "CasinoCoin-Qt"
VERSION = 2.0.0.0 VERSION = 2.0.0.0
INCLUDEPATH += src src/json src/qt INCLUDEPATH += src src/json src/qt
QT += core gui network widgets qml quick QT += core gui network widgets qml quick
@@ -119,7 +118,7 @@ contains(USE_BUILD_INFO, 1) {
QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wno-strict-aliasing -Wstack-protector QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wno-strict-aliasing -Wstack-protector
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs -Wno-maybe-uninitialized
##### Start Project Files ##### ##### Start Project Files #####

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.0, 2015-12-01T22:30:06. --> <!-- Written by QtCreator 3.5.0, 2016-04-06T14:37:15. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@@ -73,7 +73,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments">USE_UPNP=0 USE_QRCODE=1 USE_IPV6=1</value> <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments">USE_UPNP=0 USE_QRCODE=1 USE_IPV6=1</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
@@ -120,7 +120,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/a.jochems/Documents/GitHub/casinocoin-GUI-2.0</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/a.jochems/Documents/GitHub/casinocoin-issue-13</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -128,7 +128,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments">USE_UPNP=0 USE_QRCODE=1 USE_IPV6=1</value> <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments">USE_UPNP=0 USE_QRCODE=1 USE_IPV6=1</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
@@ -227,8 +227,8 @@
<value type="int" key="PE.EnvironmentAspect.Base">2</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">casinocoin-qt-windows</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">casinocoin-qt-windows</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">casinocoin-qt-windows2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/a.jochems/Documents/GitHub/casinocoin-GUI-2.0/casinocoin-qt-windows.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/a.jochems/Documents/GitHub/casinocoin-issue-13/casinocoin-qt-windows.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">casinocoin-qt-windows.pro</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">casinocoin-qt-windows.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>

View File

@@ -51,8 +51,8 @@ std::string CUnsignedAlert::ToString() const
return strprintf( return strprintf(
"CAlert(\n" "CAlert(\n"
" nVersion = %d\n" " nVersion = %d\n"
" nRelayUntil = %"PRI64d"\n" " nRelayUntil = %" PRI64d "\n"
" nExpiration = %"PRI64d"\n" " nExpiration = %" PRI64d "\n"
" nID = %d\n" " nID = %d\n"
" nCancel = %d\n" " nCancel = %d\n"
" setCancel = %s\n" " setCancel = %s\n"

View File

@@ -182,10 +182,10 @@ Value stop(const Array& params, bool fHelp)
if (fHelp || params.size() > 1) if (fHelp || params.size() > 1)
throw runtime_error( throw runtime_error(
"stop\n" "stop\n"
"Stop CasinoCoin server."); "Stop "+ COIN_NAME_DISPLAY + " server.");
// Shutdown will take long enough that the response should get back // Shutdown will take long enough that the response should get back
StartShutdown(); StartShutdown();
return "CasinoCoin server stopping"; return ""+ COIN_NAME_DISPLAY + " server stopping";
} }
@@ -299,7 +299,7 @@ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeader
{ {
ostringstream s; ostringstream s;
s << "POST / HTTP/1.1\r\n" s << "POST / HTTP/1.1\r\n"
<< "User-Agent: casinocoin-json-rpc/" << FormatFullVersion() << "\r\n" << "User-Agent: "+ COIN_NAME + "-json-rpc/" << FormatFullVersion() << "\r\n"
<< "Host: 127.0.0.1\r\n" << "Host: 127.0.0.1\r\n"
<< "Content-Type: application/json\r\n" << "Content-Type: application/json\r\n"
<< "Content-Length: " << strMsg.size() << "\r\n" << "Content-Length: " << strMsg.size() << "\r\n"
@@ -330,7 +330,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
if (nStatus == HTTP_UNAUTHORIZED) if (nStatus == HTTP_UNAUTHORIZED)
return strprintf("HTTP/1.0 401 Authorization Required\r\n" return strprintf("HTTP/1.0 401 Authorization Required\r\n"
"Date: %s\r\n" "Date: %s\r\n"
"Server: casinocoin-json-rpc/%s\r\n" "Server: "+ COIN_NAME + "-json-rpc/%s\r\n"
"WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n" "WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n"
"Content-Type: text/html\r\n" "Content-Type: text/html\r\n"
"Content-Length: 296\r\n" "Content-Length: 296\r\n"
@@ -357,7 +357,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
"Connection: %s\r\n" "Connection: %s\r\n"
"Content-Length: %"PRIszu"\r\n" "Content-Length: %"PRIszu"\r\n"
"Content-Type: application/json\r\n" "Content-Type: application/json\r\n"
"Server: casinocoin-json-rpc/%s\r\n" "Server: "+ COIN_NAME + "-json-rpc/%s\r\n"
"\r\n" "\r\n"
"%s", "%s",
nStatus, nStatus,
@@ -737,7 +737,7 @@ void StartRPCThreads()
{ {
unsigned char rand_pwd[32]; unsigned char rand_pwd[32];
RAND_bytes(rand_pwd, 32); RAND_bytes(rand_pwd, 32);
string strWhatAmI = "To use casinocoind"; string strWhatAmI = "To use "+ COIN_NAME + "d";
if (mapArgs.count("-server")) if (mapArgs.count("-server"))
strWhatAmI = strprintf(_("To use the %s option"), "\"-server\""); strWhatAmI = strprintf(_("To use the %s option"), "\"-server\"");
else if (mapArgs.count("-daemon")) else if (mapArgs.count("-daemon"))
@@ -746,13 +746,13 @@ void StartRPCThreads()
_("%s, you must set a rpcpassword in the configuration file:\n" _("%s, you must set a rpcpassword in the configuration file:\n"
"%s\n" "%s\n"
"It is recommended you use the following random password:\n" "It is recommended you use the following random password:\n"
"rpcuser=casinocoinrpc\n" "rpcuser=")+ COIN_NAME + _("rpc\n"
"rpcpassword=%s\n" "rpcpassword=%s\n"
"(you do not need to remember this password)\n" "(you do not need to remember this password)\n"
"The username and password MUST NOT be the same.\n" "The username and password MUST NOT be the same.\n"
"If the file does not exist, create it with owner-readable-only file permissions.\n" "If the file does not exist, create it with owner-readable-only file permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n" "It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"CasinoCoin Alert\" admin@foo.com\n"), "for example: alertnotify=echo %%s | mail -s \"")+ COIN_NAME_DISPLAY + _(" Alert\" admin@foo.com\n"),
strWhatAmI.c_str(), strWhatAmI.c_str(),
GetConfigFile().string().c_str(), GetConfigFile().string().c_str(),
EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()), EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()),

View File

@@ -12,7 +12,7 @@
#define NOMINMAX #define NOMINMAX
#endif #endif
#define FD_SETSIZE 1024 // max number of fds in fd_set #define FD_SETSIZE 1024 // max number of fds in fd_set
#include <winsock2.h> #include <windows.h>
#include <mswsock.h> #include <mswsock.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#else #else

View File

@@ -456,7 +456,7 @@ void CDBEnv::Flush(bool fShutdown)
else else
mi++; mi++;
} }
printf("DBFlush(%s)%s ended %15"PRI64d"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart); printf("DBFlush(%s)%s ended %15" PRI64d "ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart);
if (fShutdown) if (fShutdown)
{ {
char** listp; char** listp;

View File

@@ -10,6 +10,7 @@
#include "init.h" #include "init.h"
#include "util.h" #include "util.h"
#include "ui_interface.h" #include "ui_interface.h"
#include "version.h"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
@@ -180,12 +181,12 @@ bool AppInit(int argc, char* argv[])
if (mapArgs.count("-?") || mapArgs.count("--help")) if (mapArgs.count("-?") || mapArgs.count("--help"))
{ {
// First part of help message is specific to bitcoind / RPC client // First part of help message is specific to bitcoind / RPC client
std::string strUsage = _("CasinoCoin version") + " " + FormatFullVersion() + "\n\n" + std::string strUsage = COIN_NAME_DISPLAY + " version" + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\n" + _("Usage:") + "\n" +
" casinocoind [options] " + "\n" + " "+ COIN_NAME + "d [options] " + "\n" +
" casinocoind [options] <command> [params] " + _("Send command to -server or casinocoind") + "\n" + " "+ COIN_NAME + "d [options] <command> [params] " + "Send command to -server or "+ COIN_NAME + "d" + "\n" +
" casinocoind [options] help " + _("List commands") + "\n" + " "+ COIN_NAME + "d [options] help " + "List commands" + "\n" +
" casinocoind [options] help <command> " + _("Get help for a command") + "\n"; " "+ COIN_NAME + "d [options] help <command> " + "Get help for a command" + "\n";
strUsage += "\n" + HelpMessage(); strUsage += "\n" + HelpMessage();
@@ -195,7 +196,7 @@ bool AppInit(int argc, char* argv[])
// Command-line RPC // Command-line RPC
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "casinocoin:")) if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], (std::string("") + COIN_NAME + ":").c_str()))
fCommandLine = true; fCommandLine = true;
if (fCommandLine) if (fCommandLine)
@@ -298,8 +299,8 @@ std::string HelpMessage()
{ {
string strUsage = _("Options:") + "\n" + string strUsage = _("Options:") + "\n" +
" -? " + _("This help message") + "\n" + " -? " + _("This help message") + "\n" +
" -conf=<file> " + _("Specify configuration file (default: casinocoin.conf)") + "\n" + " -conf=<file> " + "Specify configuration file (default: "+ COIN_NAME + ".conf)" + "\n" +
" -pid=<file> " + _("Specify pid file (default: casinocoind.pid)") + "\n" + " -pid=<file> " + "Specify pid file (default: "+ COIN_NAME + "d.pid)" + "\n" +
" -gen " + _("Generate coins (default: 0)") + "\n" + " -gen " + _("Generate coins (default: 0)") + "\n" +
" -datadir=<dir> " + _("Specify data directory") + "\n" + " -datadir=<dir> " + _("Specify data directory") + "\n" +
" -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n" + " -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n" +
@@ -376,7 +377,7 @@ std::string HelpMessage()
" -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n" + " -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n" +
" -blockprioritysize=<n> " + _("Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") + "\n" + " -blockprioritysize=<n> " + _("Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") + "\n" +
"\n" + _("SSL options: (see the CasinoCoin Wiki for SSL setup instructions)") + "\n" + "\n" + "SSL options: (see the "+ COIN_NAME_DISPLAY + " Wiki for SSL setup instructions)" + "\n" +
" -rpcssl " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" + " -rpcssl " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" +
" -rpcsslcertificatechainfile=<file.cert> " + _("Server certificate file (default: server.cert)") + "\n" + " -rpcsslcertificatechainfile=<file.cert> " + _("Server certificate file (default: server.cert)") + "\n" +
" -rpcsslprivatekeyfile=<file.pem> " + _("Server private key (default: server.pem)") + "\n" + " -rpcsslprivatekeyfile=<file.pem> " + _("Server private key (default: server.pem)") + "\n" +
@@ -645,12 +646,13 @@ bool AppInit2(boost::thread_group& threadGroup)
if (file) fclose(file); if (file) fclose(file);
static boost::interprocess::file_lock lock(pathLockFile.string().c_str()); static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
if (!lock.try_lock()) if (!lock.try_lock())
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. CasinoCoin is probably already running."), strDataDir.c_str())); return InitError(strprintf((std::string("Cannot obtain a lock on data directory %s. ")+ COIN_NAME_DISPLAY + " is probably already running.").c_str(), strDataDir.c_str()));
if (GetBoolArg("-shrinkdebugfile", !fDebug)) if (GetBoolArg("-shrinkdebugfile", !fDebug))
ShrinkDebugFile(); ShrinkDebugFile();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("CasinoCoin version %s (%s)\n", FormatFullVersion().c_str(), CLIENT_DATE.c_str()); std::string versionString = COIN_NAME_DISPLAY + " version %s (%s)\n";
printf(versionString.c_str(), FormatFullVersion().c_str(), CLIENT_DATE.c_str());
printf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION)); printf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION));
if (!fLogTimestamps) if (!fLogTimestamps)
printf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str()); printf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str());
@@ -660,8 +662,9 @@ bool AppInit2(boost::thread_group& threadGroup)
std::ostringstream strErrors; std::ostringstream strErrors;
if (fDaemon) if (fDaemon)
fprintf(stdout, "CasinoCoin server starting\n"); {
fprintf(stdout, "%s server starting\n", COIN_NAME_DISPLAY.c_str());
}
if (nScriptCheckThreads) { if (nScriptCheckThreads) {
printf("Using %u threads for script verification\n", nScriptCheckThreads); printf("Using %u threads for script verification\n", nScriptCheckThreads);
for (int i=0; i<nScriptCheckThreads-1; i++) for (int i=0; i<nScriptCheckThreads-1; i++)
@@ -683,7 +686,7 @@ bool AppInit2(boost::thread_group& threadGroup)
{ {
// try moving the database env out of the way // try moving the database env out of the way
boost::filesystem::path pathDatabase = GetDataDir() / "database"; boost::filesystem::path pathDatabase = GetDataDir() / "database";
boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%"PRI64d".bak", GetTime()); boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%" PRI64d ".bak", GetTime());
try { try {
boost::filesystem::rename(pathDatabase, pathDatabaseBak); boost::filesystem::rename(pathDatabase, pathDatabaseBak);
printf("Moved old %s to %s. Retrying.\n", pathDatabase.string().c_str(), pathDatabaseBak.string().c_str()); printf("Moved old %s to %s. Retrying.\n", pathDatabase.string().c_str(), pathDatabaseBak.string().c_str());
@@ -947,7 +950,7 @@ bool AppInit2(boost::thread_group& threadGroup)
printf("Shutdown requested. Exiting.\n"); printf("Shutdown requested. Exiting.\n");
return false; return false;
} }
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf(" block index %15" PRI64d "ms\n", GetTimeMillis() - nStart);
if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree")) if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
{ {
@@ -1001,10 +1004,10 @@ bool AppInit2(boost::thread_group& threadGroup)
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 CasinoCoin") << "\n"; strErrors << "Error loading wallet.dat: Wallet requires newer version of " << COIN_NAME_DISPLAY << "\n";
else if (nLoadWalletRet == DB_NEED_REWRITE) else if (nLoadWalletRet == DB_NEED_REWRITE)
{ {
strErrors << _("Wallet needed to be rewritten: restart CasinoCoin to complete") << "\n"; strErrors << "Wallet needed to be rewritten: restart "<< COIN_NAME_DISPLAY << " to complete" << "\n";
printf("%s", strErrors.str().c_str()); printf("%s", strErrors.str().c_str());
return InitError(strErrors.str()); return InitError(strErrors.str());
} }
@@ -1044,7 +1047,7 @@ bool AppInit2(boost::thread_group& threadGroup)
} }
printf("%s", strErrors.str().c_str()); printf("%s", strErrors.str().c_str());
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf(" wallet %15" PRI64d "ms\n", GetTimeMillis() - nStart);
RegisterWallet(pwalletMain); RegisterWallet(pwalletMain);
@@ -1066,7 +1069,7 @@ bool AppInit2(boost::thread_group& threadGroup)
printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight); printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis(); nStart = GetTimeMillis();
pwalletMain->ScanForWalletTransactions(pindexRescan, true); pwalletMain->ScanForWalletTransactions(pindexRescan, true);
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf(" rescan %15" PRI64d "ms\n", GetTimeMillis() - nStart);
pwalletMain->SetBestChain(CBlockLocator(pindexBest)); pwalletMain->SetBestChain(CBlockLocator(pindexBest));
nWalletDBUpdated++; nWalletDBUpdated++;
} }
@@ -1099,7 +1102,7 @@ bool AppInit2(boost::thread_group& threadGroup)
printf("Invalid or missing peers.dat; recreating\n"); printf("Invalid or missing peers.dat; recreating\n");
} }
printf("Loaded %i addresses from peers.dat %"PRI64d"ms\n", printf("Loaded %i addresses from peers.dat %" PRI64d "ms\n",
addrman.size(), GetTimeMillis() - nStart); addrman.size(), GetTimeMillis() - nStart);
// ********************************************************* Step 11: start node // ********************************************************* Step 11: start node
@@ -1113,11 +1116,11 @@ bool AppInit2(boost::thread_group& threadGroup)
RandAddSeedPerfmon(); RandAddSeedPerfmon();
//// debug print //// debug print
printf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size()); printf("mapBlockIndex.size() = %" PRIszu "\n", mapBlockIndex.size());
printf("nBestHeight = %d\n", nBestHeight); printf("nBestHeight = %d\n", nBestHeight);
printf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); printf("setKeyPool.size() = %" PRIszu "\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
printf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); printf("mapWallet.size() = %" PRIszu "\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
printf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); printf("mapAddressBook.size() = %" PRIszu "\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
StartNode(threadGroup); StartNode(threadGroup);

View File

@@ -66,7 +66,7 @@ map<uint256, set<uint256> > mapOrphanTransactionsByPrev;
// Constant stuff for coinbase transactions we create: // Constant stuff for coinbase transactions we create:
CScript COINBASE_FLAGS; CScript COINBASE_FLAGS;
const string strMessageMagic = "CasinoCoin Signed Message:\n"; const string strMessageMagic = COIN_NAME_DISPLAY + " Signed Message:\n";
double dHashesPerSec = 0.0; double dHashesPerSec = 0.0;
int64 nHPSTimerStart = 0; int64 nHPSTimerStart = 0;
@@ -309,7 +309,7 @@ bool AddOrphanTx(const CTransaction& tx)
BOOST_FOREACH(const CTxIn& txin, tx.vin) BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash); mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash);
printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().c_str(), printf("stored orphan tx %s (mapsz %" PRIszu ")\n", hash.ToString().c_str(),
mapOrphanTransactions.size()); mapOrphanTransactions.size());
return true; return true;
} }
@@ -755,7 +755,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn
// Don't accept it if it can't get into a block // Don't accept it if it can't get into a block
int64 txMinFee = tx.GetMinFee(1000, true, GMF_RELAY); int64 txMinFee = tx.GetMinFee(1000, true, GMF_RELAY);
if (fLimitFree && nFees < txMinFee) if (fLimitFree && nFees < txMinFee)
return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d, return error("CTxMemPool::accept() : not enough fees %s, %" PRI64d " < %" PRI64d,
hash.ToString().c_str(), hash.ToString().c_str(),
nFees, txMinFee); nFees, txMinFee);
@@ -1239,7 +1239,7 @@ unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const
// Limit adjustment step // Limit adjustment step
int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan); printf(" nActualTimespan = %" PRI64d " before bounds\n", nActualTimespan);
if (nActualTimespan < nTargetTimespan/4) if (nActualTimespan < nTargetTimespan/4)
nActualTimespan = nTargetTimespan/4; nActualTimespan = nTargetTimespan/4;
if (nActualTimespan > nTargetTimespan*4) if (nActualTimespan > nTargetTimespan*4)
@@ -1256,7 +1256,7 @@ unsigned int static GetNextWorkRequired_V1(const CBlockIndex* pindexLast, const
/// debug print /// debug print
printf("Difficulty Retarget - GetNextWorkRequired_V1 RETARGET\n"); printf("Difficulty Retarget - GetNextWorkRequired_V1 RETARGET\n");
printf("nTargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", nTargetTimespan, nActualTimespan); printf("nTargetTimespan = %" PRI64d " nActualTimespan = %" PRI64d "\n", nTargetTimespan, nActualTimespan);
printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
@@ -1390,7 +1390,7 @@ unsigned int static DigiShield(const CBlockIndex* pindexLast, const CBlockHeader
// Limit adjustment step // Limit adjustment step
int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan); printf(" nActualTimespan = %" PRI64d " before bounds\n", nActualTimespan);
@@ -1406,7 +1406,7 @@ unsigned int static DigiShield(const CBlockIndex* pindexLast, const CBlockHeader
/// debug print /// debug print
printf("DigiShield RETARGET \n"); printf("DigiShield RETARGET \n");
printf("retargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", retargetTimespan, nActualTimespan); printf("retargetTimespan = %" PRI64d " nActualTimespan = %" PRI64d "\n", retargetTimespan, nActualTimespan);
printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
@@ -1964,7 +1964,7 @@ bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsVi
printf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)vtx.size(), 0.001 * nTime, 0.001 * nTime / vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1)); printf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)vtx.size(), 0.001 * nTime, 0.001 * nTime / vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1));
if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees)) if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees))); return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%" PRI64d " vs limit=%" PRI64d ")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees)));
if (!control.Wait()) if (!control.Wait())
return state.DoS(100, false); return state.DoS(100, false);
@@ -2044,8 +2044,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
reverse(vConnect.begin(), vConnect.end()); reverse(vConnect.begin(), vConnect.end());
if (vDisconnect.size() > 0) { if (vDisconnect.size() > 0) {
printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); printf("REORGANIZE: Disconnect %" PRIszu " blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str());
printf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); printf("REORGANIZE: Connect %" PRIszu " blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str());
} }
// Disconnect shorter branch // Disconnect shorter branch
@@ -3153,7 +3153,7 @@ void PrintBlockTree()
// print item // print item
CBlock block; CBlock block;
block.ReadFromDisk(pindex); block.ReadFromDisk(pindex);
printf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"", printf("%d (blk%05u.dat:0x%x) %s tx %" PRIszu "",
pindex->nHeight, pindex->nHeight,
pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos, pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(),
@@ -3246,7 +3246,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
AbortNode(_("Error: system error: ") + e.what()); AbortNode(_("Error: system error: ") + e.what());
} }
if (nLoaded > 0) if (nLoaded > 0)
printf("Loaded %i blocks from external file in %"PRI64d"ms\n", nLoaded, GetTimeMillis() - nStart); printf("Loaded %i blocks from external file in %" PRI64d "ms\n", nLoaded, GetTimeMillis() - nStart);
return nLoaded > 0; return nLoaded > 0;
} }
@@ -3498,7 +3498,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{ {
RandAddSeedPerfmon(); RandAddSeedPerfmon();
if (fDebug) if (fDebug)
printf("received: %s (%"PRIszu" bytes)\n", strCommand.c_str(), vRecv.size()); printf("received: %s (%" PRIszu " bytes)\n", strCommand.c_str(), vRecv.size());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
{ {
printf("dropmessagestest DROPPING RECV MESSAGE\n"); printf("dropmessagestest DROPPING RECV MESSAGE\n");
@@ -3637,7 +3637,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vAddr.size() > 1000) if (vAddr.size() > 1000)
{ {
pfrom->Misbehaving(20); pfrom->Misbehaving(20);
return error("message addr size() = %"PRIszu"", vAddr.size()); return error("message addr size() = %" PRIszu "", vAddr.size());
} }
// Store the new addresses // Store the new addresses
@@ -3700,7 +3700,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vInv.size() > MAX_INV_SZ) if (vInv.size() > MAX_INV_SZ)
{ {
pfrom->Misbehaving(20); pfrom->Misbehaving(20);
return error("message inv size() = %"PRIszu"", vInv.size()); return error("message inv size() = %" PRIszu "", vInv.size());
} }
// find last block in inv vector // find last block in inv vector
@@ -3749,11 +3749,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (vInv.size() > MAX_INV_SZ) if (vInv.size() > MAX_INV_SZ)
{ {
pfrom->Misbehaving(20); pfrom->Misbehaving(20);
return error("message getdata size() = %"PRIszu"", vInv.size()); return error("message getdata size() = %" PRIszu "", vInv.size());
} }
if (fDebugNet || (vInv.size() != 1)) if (fDebugNet || (vInv.size() != 1))
printf("received getdata (%"PRIszu" invsz)\n", vInv.size()); printf("received getdata (%" PRIszu " invsz)\n", vInv.size());
if ((fDebugNet && vInv.size() > 0) || (vInv.size() == 1)) if ((fDebugNet && vInv.size() > 0) || (vInv.size() == 1))
printf("received getdata for: %s\n", vInv[0].ToString().c_str()); printf("received getdata for: %s\n", vInv[0].ToString().c_str());
@@ -3854,7 +3854,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vWorkQueue.push_back(inv.hash); vWorkQueue.push_back(inv.hash);
vEraseQueue.push_back(inv.hash); vEraseQueue.push_back(inv.hash);
printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %"PRIszu")\n", printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %" PRIszu ")\n",
pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(), pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(),
tx.GetHash().ToString().c_str(), tx.GetHash().ToString().c_str(),
mempool.mapTx.size()); mempool.mapTx.size());
@@ -4703,7 +4703,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
nLastBlockTx = nBlockTx; nLastBlockTx = nBlockTx;
nLastBlockSize = nBlockSize; nLastBlockSize = nBlockSize;
printf("CreateNewBlock(): total size %"PRI64u"\n", nBlockSize); printf("CreateNewBlock(): total size %" PRI64u "\n", nBlockSize);
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees); pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
pblocktemplate->vTxFees[0] = -nFees; pblocktemplate->vTxFees[0] = -nFees;
@@ -4866,7 +4866,7 @@ void static CasinoCoinMiner(CWallet *pwallet)
CBlock *pblock = &pblocktemplate->block; CBlock *pblock = &pblocktemplate->block;
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
printf("Running CasinoCoinMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(), printf("Running CasinoCoinMiner with %" PRIszu " transactions in block (%u bytes)\n", pblock->vtx.size(),
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION)); ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
// //

View File

@@ -448,7 +448,7 @@ public:
{ {
if (scriptPubKey.size() < 6) if (scriptPubKey.size() < 6)
return "CTxOut(error)"; return "CTxOut(error)";
return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); return strprintf("CTxOut(nValue=%" PRI64d ".%08" PRI64d ", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str());
} }
void print() const void print() const
@@ -644,7 +644,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach
std::string ToString() const std::string ToString() const
{ {
std::string str; std::string str;
str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n", str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%" PRIszu ", vout.size=%" PRIszu ", nLockTime=%u)\n",
GetHash().ToString().c_str(), GetHash().ToString().c_str(),
nVersion, nVersion,
vin.size(), vin.size(),
@@ -1488,7 +1488,7 @@ public:
void print() const void print() const
{ {
printf("CBlock(hash=%s, input=%s, PoW=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n", printf("CBlock(hash=%s, input=%s, PoW=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%" PRIszu ")\n",
GetHash().ToString().c_str(), GetHash().ToString().c_str(),
HexStr(BEGIN(nVersion),BEGIN(nVersion)+80,false).c_str(), HexStr(BEGIN(nVersion),BEGIN(nVersion)+80,false).c_str(),
GetPoWHash().ToString().c_str(), GetPoWHash().ToString().c_str(),

View File

@@ -1262,7 +1262,7 @@ void DumpAddresses()
CAddrDB adb; CAddrDB adb;
adb.Write(addrman); adb.Write(addrman);
printf("Flushed %d addresses to peers.dat %"PRI64d"ms\n", printf("Flushed %d addresses to peers.dat %" PRI64d "ms\n",
addrman.size(), GetTimeMillis() - nStart); addrman.size(), GetTimeMillis() - nStart);
} }

View File

@@ -366,7 +366,7 @@ public:
else else
nRequestTime = 0; nRequestTime = 0;
if (fDebugNet) if (fDebugNet)
printf("askfor %s %"PRI64d" (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str()); printf("askfor %s %" PRI64d " (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str());
// Make sure not to reuse time indexes to keep things in the same order // Make sure not to reuse time indexes to keep things in the same order
int64 nNow = (GetTime() - 1) * 1000000; int64 nNow = (GetTime() - 1) * 1000000;

View File

@@ -3,6 +3,7 @@
#include "guiconstants.h" #include "guiconstants.h"
#include "walletmodel.h" #include "walletmodel.h"
#include "version.h"
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
@@ -98,7 +99,8 @@ void AskPassphraseDialog::accept()
break; break;
} }
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"), QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"),
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR CASINOCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"), tr((std::string("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR ")
+ COIN_NAME_DISPLAY + "</b>!").c_str()) + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes|QMessageBox::Cancel,
QMessageBox::Cancel); QMessageBox::Cancel);
if(retval == QMessageBox::Yes) if(retval == QMessageBox::Yes)
@@ -109,9 +111,9 @@ void AskPassphraseDialog::accept()
{ {
QMessageBox::warning(this, tr("Wallet encrypted"), QMessageBox::warning(this, tr("Wallet encrypted"),
"<qt>" + "<qt>" +
tr("CasinoCoin will close now to finish the encryption process. " tr((std::string("")+ COIN_NAME_DISPLAY + " will close now to finish the encryption process. "
"Remember that encrypting your wallet cannot fully protect " "Remember that encrypting your wallet cannot fully protect "
"your casinocoins from being stolen by malware infecting your computer.") + "your "+ COIN_NAME + " from being stolen by malware infecting your computer.").c_str()) +
"<br><br><b>" + "<br><br><b>" +
tr("IMPORTANT: Any previous backups you have made of your wallet file " tr("IMPORTANT: Any previous backups you have made of your wallet file "
"should be replaced with the newly generated, encrypted wallet file. " "should be replaced with the newly generated, encrypted wallet file. "

View File

@@ -110,7 +110,7 @@ static std::string Translate(const char* psz)
static void handleRunawayException(std::exception *e) static void handleRunawayException(std::exception *e)
{ {
PrintExceptionContinue(e, "Runaway exception"); PrintExceptionContinue(e, "Runaway exception");
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. CasinoCoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning)); QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr(("A fatal error occurred. "+ COIN_NAME_DISPLAY + " can no longer continue safely and will quit.").c_str()) + QString("\n\n") + QString::fromStdString(strMiscWarning));
exit(1); exit(1);
} }
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
{ {
// This message can not be translated, as translation is not initialized yet // This message can not be translated, as translation is not initialized yet
// (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory) // (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory)
QMessageBox::critical(0, "CasinoCoin", QMessageBox::critical(0, COIN_NAME_DISPLAY.c_str(),
QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"]))); QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
return 1; return 1;
} }
@@ -154,12 +154,12 @@ int main(int argc, char *argv[])
// Application identification (must be set before OptionsModel is initialized, // Application identification (must be set before OptionsModel is initialized,
// as it is used to locate QSettings) // as it is used to locate QSettings)
QApplication::setOrganizationName("CasinoCoin"); QApplication::setOrganizationName(COIN_NAME_DISPLAY.c_str());
QApplication::setOrganizationDomain("casinocoin.org"); QApplication::setOrganizationDomain("casinocoin.org");
if(GetBoolArg("-testnet")) // Separate UI settings for testnet if(GetBoolArg("-testnet")) // Separate UI settings for testnet
QApplication::setApplicationName("CasinoCoin-Qt-testnet"); QApplication::setApplicationName((""+ COIN_NAME_DISPLAY + "-Qt-testnet").c_str());
else else
QApplication::setApplicationName("CasinoCoin-Qt"); QApplication::setApplicationName((""+ COIN_NAME_DISPLAY + "-Qt").c_str());
// ... then GUI settings: // ... then GUI settings:
OptionsModel optionsModel; OptionsModel optionsModel;

View File

@@ -1,4 +1,5 @@
#include <QtGlobal> #include <QtGlobal>
#include "version.h"
// Automatically generated by extract_strings.py // Automatically generated by extract_strings.py
#ifdef __GNUC__ #ifdef __GNUC__
#define UNUSED __attribute__((unused)) #define UNUSED __attribute__((unused))
@@ -6,18 +7,19 @@
#define UNUSED #define UNUSED
#endif #endif
static const char UNUSED *bitcoin_strings[] = { static const char UNUSED *bitcoin_strings[] = {
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"%s, you must set a rpcpassword in the configuration file:\n" "%s, you must set a rpcpassword in the configuration file:\n" +
"%s\n" "%s\n" +
"It is recommended you use the following random password:\n" "It is recommended you use the following random password:\n" +
"rpcuser=casinocoinrpc\n" "rpcuser=" + COIN_NAME +"rpc\n" +
"rpcpassword=%s\n" "rpcpassword=%s\n" +
"(you do not need to remember this password)\n" "(you do not need to remember this password)\n" +
"The username and password MUST NOT be the same.\n" "The username and password MUST NOT be the same.\n" +
"If the file does not exist, create it with owner-readable-only file " "If the file does not exist, create it with owner-readable-only file " +
"permissions.\n" "permissions.\n" +
"It is also recommended to set alertnotify so you are notified of problems;\n" "It is also recommended to set alertnotify so you are notified of problems;\n" +
"for example: alertnotify=echo %%s | mail -s \"CasinoCoin Alert\" admin@foo.com\n"), "for example: alertnotify=echo %%s | mail -s \"" + COIN_NAME_DISPLAY +
" Alert\" admin@foo.com\n").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", ""
"Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:" "Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:"
"@STRENGTH)"), "@STRENGTH)"),
@@ -29,9 +31,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", ""
"Bind to given address and always listen on it. Use [host]:port notation for " "Bind to given address and always listen on it. Use [host]:port notation for "
"IPv6"), "IPv6"),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"Cannot obtain a lock on data directory %s. CasinoCoin is probably already " "Cannot obtain a lock on data directory %s. "+ COIN_NAME_DISPLAY + " is probably already "
"running."), "running.").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", ""
"Error: The transaction was rejected! This might happen if some of the coins " "Error: The transaction was rejected! This might happen if some of the coins "
"in your wallet were already spent, such as if you used a copy of wallet.dat " "in your wallet were already spent, such as if you used a copy of wallet.dat "
@@ -62,17 +64,17 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", ""
"This is a pre-release test build - use at your own risk - do not use for " "This is a pre-release test build - use at your own risk - do not use for "
"mining or merchant applications"), "mining or merchant applications"),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"Unable to bind to %s on this computer. CasinoCoin is probably already running."), "Unable to bind to %s on this computer. "+ COIN_NAME_DISPLAY + " is probably already running.").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: -paytxfee is set very high! This is the transaction fee you will " "Warning: -paytxfee is set very high! This is the transaction fee you will "
"pay if you send a transaction."), "pay if you send a transaction."),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: Displayed transactions may not be correct! You may need to upgrade, " "Warning: Displayed transactions may not be correct! You may need to upgrade, "
"or other nodes may need to upgrade."), "or other nodes may need to upgrade."),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", (std::string("") +
"Warning: Please check that your computer's date and time are correct! If " "Warning: Please check that your computer's date and time are correct! If "
"your clock is wrong CasinoCoin will not work properly."), "your clock is wrong "+ COIN_NAME_DISPLAY + " will not work properly.").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "" QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: error reading wallet.dat! All keys read correctly, but transaction " "Warning: error reading wallet.dat! All keys read correctly, but transaction "
"data or address book entries might be missing or incorrect."), "data or address book entries might be missing or incorrect."),
@@ -91,7 +93,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "CasinoCoin version"), QT_TRANSLATE_NOOP("bitcoin-core", (COIN_NAME_DISPLAY + " version").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"),
@@ -109,7 +111,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environmen
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of CasinoCoin"), QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Error loading wallet.dat: Wallet requires newer version of ")+ COIN_NAME_DISPLAY + "").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error"), QT_TRANSLATE_NOOP("bitcoin-core", "Error"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"), QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"),
@@ -162,9 +164,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000
QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."), QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"), QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the CasinoCoin Wiki for SSL setup instructions)"), QT_TRANSLATE_NOOP("bitcoin-core", (std::string("SSL options: (see the ") + COIN_NAME_DISPLAY + " Wiki for SSL setup instructions)").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"), QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or casinocoind"), QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Send command to -server or ") + COIN_NAME + "d").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"), QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"),
@@ -177,10 +179,10 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"
QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"), QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"), QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: casinocoin.conf)"), QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Specify configuration file (default: ") + COIN_NAME + ".conf)").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: casinocoind.pid)"), QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Specify pid file (default: ") + COIN_NAME + "d.pid)").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"),
QT_TRANSLATE_NOOP("bitcoin-core", "System error: "), QT_TRANSLATE_NOOP("bitcoin-core", "System error: "),
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"), QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
@@ -202,7 +204,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."), QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart CasinoCoin to complete"), QT_TRANSLATE_NOOP("bitcoin-core", (std::string("Wallet needed to be rewritten: restart ")+ COIN_NAME_DISPLAY + " to complete").c_str()),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"), QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"),
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"), QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),

View File

@@ -84,7 +84,7 @@ void setupAmountWidget(QLineEdit *widget, QWidget *parent)
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{ {
// return if URI is not valid or is no bitcoin URI // return if URI is not valid or is no bitcoin URI
if(!uri.isValid() || uri.scheme() != QString("casinocoin")) if(!uri.isValid() || uri.scheme() != QString(COIN_NAME.c_str()))
return false; return false;
SendCoinsRecipient rv; SendCoinsRecipient rv;
@@ -139,9 +139,9 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
// //
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host, // Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
// which will lower-case it (and thus invalidate the address). // which will lower-case it (and thus invalidate the address).
if(uri.startsWith("casinocoin://")) if(uri.startsWith(QString((COIN_NAME + "://").c_str())))
{ {
uri.replace(0, 11, "casinocoin:"); uri.replace(0, (COIN_NAME.length()+1), QString((COIN_NAME + ":").c_str()));
} }
QUrl uriInstance(uri); QUrl uriInstance(uri);
return parseBitcoinURI(uriInstance, out); return parseBitcoinURI(uriInstance, out);
@@ -301,7 +301,7 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
#ifdef WIN32 #ifdef WIN32
boost::filesystem::path static StartupShortcutPath() boost::filesystem::path static StartupShortcutPath()
{ {
return GetSpecialFolderPath(CSIDL_STARTUP) / "CasinoCoin.lnk"; return GetSpecialFolderPath(CSIDL_STARTUP) / (COIN_NAME_DISPLAY + ".lnk").c_str();
} }
bool GetStartOnSystemStartup() bool GetStartOnSystemStartup()
@@ -383,7 +383,7 @@ boost::filesystem::path static GetAutostartDir()
boost::filesystem::path static GetAutostartFilePath() boost::filesystem::path static GetAutostartFilePath()
{ {
return GetAutostartDir() / "casinocoin.desktop"; return GetAutostartDir() / ""+ COIN_NAME + ".desktop";
} }
bool GetStartOnSystemStartup() bool GetStartOnSystemStartup()
@@ -424,7 +424,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
// Write a bitcoin.desktop file to the autostart directory: // Write a bitcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n"; optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n"; optionFile << "Type=Application\n";
optionFile << "Name=CasinoCoin\n"; optionFile << "Name="+ COIN_NAME_DISPLAY + "\n";
optionFile << "Exec=" << pszExePath << " -min\n"; optionFile << "Exec=" << pszExePath << " -min\n";
optionFile << "Terminal=false\n"; optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n"; optionFile << "Hidden=false\n";
@@ -495,10 +495,10 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
HelpMessageBox::HelpMessageBox(QWidget *parent) : HelpMessageBox::HelpMessageBox(QWidget *parent) :
QMessageBox(parent) QMessageBox(parent)
{ {
header = tr("CasinoCoin-Qt") + " " + tr("version") + " " + header = tr((COIN_NAME_DISPLAY + "-Qt").c_str()) + " " + tr("version") + " " +
QString::fromStdString(FormatFullVersion()) + "\n\n" + QString::fromStdString(FormatFullVersion()) + "\n\n" +
tr("Usage:") + "\n" + tr("Usage:") + "\n" +
" casinocoin-qt [" + tr("command-line options") + "] " + "\n"; QString::fromStdString(" "+ COIN_NAME + "-qt [") + tr("command-line options") + "] " + "\n";
coreOptions = QString::fromStdString(HelpMessage()); coreOptions = QString::fromStdString(HelpMessage());
@@ -507,7 +507,7 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) :
" -min " + tr("Start minimized") + "\n" + " -min " + tr("Start minimized") + "\n" +
" -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; " -splash " + tr("Show splash screen on startup (default: 1)") + "\n";
setWindowTitle(tr("CasinoCoin-Qt")); setWindowTitle(tr((COIN_NAME_DISPLAY + "-Qt").c_str()));
setTextFormat(Qt::PlainText); setTextFormat(Qt::PlainText);
// setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider. // setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider.
setText(header + QString(QChar(0x2003)).repeated(50)); setText(header + QString(QChar(0x2003)).repeated(50));

View File

@@ -106,7 +106,7 @@ PaymentServer::PaymentServer(QApplication* parent) : QObject(parent), saveURIs(t
uriServer = new QLocalServer(this); uriServer = new QLocalServer(this);
if (!uriServer->listen(name)) if (!uriServer->listen(name))
qDebug() << tr("Cannot start casinocoin: click-to-pay handler"); qDebug() << tr((std::string("Cannot start ")+ COIN_NAME + ": click-to-pay handler").c_str());
else else
connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection())); connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection()));
} }

View File

@@ -5,6 +5,7 @@
#include "guiconstants.h" #include "guiconstants.h"
#include "guiutil.h" #include "guiutil.h"
#include "optionsmodel.h" #include "optionsmodel.h"
#include "version.h"
#include <QPixmap> #include <QPixmap>
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
@@ -85,7 +86,7 @@ void QRCodeDialog::genCode()
QString QRCodeDialog::getURI() QString QRCodeDialog::getURI()
{ {
QString ret = QString("casinocoin:%1").arg(address); QString ret = QString((COIN_NAME + ":%1").c_str()).arg(address);
int paramCount = 0; int paramCount = 0;
ui->outUri->clear(); ui->outUri->clear();

View File

@@ -36,7 +36,7 @@ Value importprivkey(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() < 1 || params.size() > 3) if (fHelp || params.size() < 1 || params.size() > 3)
throw runtime_error( throw runtime_error(
"importprivkey <casinocoinprivkey> [label] [rescan=true]\n" "importprivkey <"+ COIN_NAME + "privkey> [label] [rescan=true]\n"
"Adds a private key (as returned by dumpprivkey) to your wallet."); "Adds a private key (as returned by dumpprivkey) to your wallet.");
string strSecret = params[0].get_str(); string strSecret = params[0].get_str();
@@ -79,13 +79,13 @@ Value dumpprivkey(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() != 1) if (fHelp || params.size() != 1)
throw runtime_error( throw runtime_error(
"dumpprivkey <casinocoinaddress>\n" "dumpprivkey <"+ COIN_NAME + "address>\n"
"Reveals the private key corresponding to <casinocoinaddress>."); "Reveals the private key corresponding to <"+ COIN_NAME + "address>.");
string strAddress = params[0].get_str(); string strAddress = params[0].get_str();
CBitcoinAddress address; CBitcoinAddress address;
if (!address.SetString(strAddress)) if (!address.SetString(strAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid "+ COIN_NAME_DISPLAY + " address");
CKeyID keyID; CKeyID keyID;
if (!address.GetKeyID(keyID)) if (!address.GetKeyID(keyID))
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key"); throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");

View File

@@ -171,10 +171,10 @@ Value getworkex(const Array& params, bool fHelp)
); );
if (vNodes.empty()) if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "CasinoCoin is not connected!"); throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, ""+ COIN_NAME_DISPLAY + " is not connected!");
if (IsInitialBlockDownload()) if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "CasinoCoin is downloading blocks..."); throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, ""+ COIN_NAME_DISPLAY + " is downloading blocks...");
typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t; typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
static mapNewBlock_t mapNewBlock; // FIXME: thread safety static mapNewBlock_t mapNewBlock; // FIXME: thread safety
@@ -311,10 +311,10 @@ Value getwork(const Array& params, bool fHelp)
"If [data] is specified, tries to solve the block and returns true if it was successful."); "If [data] is specified, tries to solve the block and returns true if it was successful.");
if (vNodes.empty()) if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "CasinoCoin is not connected!"); throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, ""+ COIN_NAME_DISPLAY + " is not connected!");
if (IsInitialBlockDownload()) if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "CasinoCoin is downloading blocks..."); throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, ""+ COIN_NAME_DISPLAY + " is downloading blocks...");
typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t; typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
static mapNewBlock_t mapNewBlock; // FIXME: thread safety static mapNewBlock_t mapNewBlock; // FIXME: thread safety
@@ -453,10 +453,10 @@ Value getblocktemplate(const Array& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if (vNodes.empty()) if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "CasinoCoin is not connected!"); throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, ""+ COIN_NAME_DISPLAY + " is not connected!");
if (IsInitialBlockDownload()) if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "CasinoCoin is downloading blocks..."); throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, ""+ COIN_NAME_DISPLAY + " is downloading blocks...");
// Update block // Update block
static unsigned int nTransactionsUpdatedLast; static unsigned int nTransactionsUpdatedLast;

View File

@@ -48,7 +48,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
Object obj; Object obj;
obj.push_back(Pair("addr", stats.addrName)); obj.push_back(Pair("addr", stats.addrName));
obj.push_back(Pair("services", strprintf("%08"PRI64x, stats.nServices))); obj.push_back(Pair("services", strprintf("%08" PRI64x, stats.nServices)));
obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend)); obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend));
obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv)); obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv));
obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes)); obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes));

View File

@@ -195,7 +195,7 @@ Value listunspent(const Array& params, bool fHelp)
{ {
CBitcoinAddress address(input.get_str()); CBitcoinAddress address(input.get_str());
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CasinoCoin address: ")+input.get_str()); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid "+ COIN_NAME_DISPLAY + " address: ")+input.get_str());
if (setAddress.count(address)) if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str()); throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str());
setAddress.insert(address); setAddress.insert(address);
@@ -294,7 +294,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
{ {
CBitcoinAddress address(s.name_); CBitcoinAddress address(s.name_);
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CasinoCoin address: ")+s.name_); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid "+ COIN_NAME_DISPLAY + " address: ")+s.name_);
if (setAddress.count(address)) if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_); throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);

View File

@@ -101,7 +101,7 @@ Value getnewaddress(const Array& params, bool fHelp)
if (fHelp || params.size() > 1) if (fHelp || params.size() > 1)
throw runtime_error( throw runtime_error(
"getnewaddress [account]\n" "getnewaddress [account]\n"
"Returns a new CasinoCoin address for receiving payments. " "Returns a new " + COIN_NAME_DISPLAY + " address for receiving payments. "
"If [account] is specified (recommended), it is added to the address book " "If [account] is specified (recommended), it is added to the address book "
"so payments received with the address will be credited to [account]."); "so payments received with the address will be credited to [account].");
@@ -145,10 +145,12 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
{ {
const CWalletTx& wtx = (*it).second; const CWalletTx& wtx = (*it).second;
BOOST_FOREACH(const CTxOut& txout, wtx.vout) BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
if (txout.scriptPubKey == scriptPubKey) if (txout.scriptPubKey == scriptPubKey)
bKeyUsed = true; bKeyUsed = true;
} }
} }
}
// Generate a new key // Generate a new key
if (!account.vchPubKey.IsValid() || bForceNew || bKeyUsed) if (!account.vchPubKey.IsValid() || bForceNew || bKeyUsed)
@@ -168,7 +170,7 @@ Value getaccountaddress(const Array& params, bool fHelp)
if (fHelp || params.size() != 1) if (fHelp || params.size() != 1)
throw runtime_error( throw runtime_error(
"getaccountaddress <account>\n" "getaccountaddress <account>\n"
"Returns the current CasinoCoin address for receiving payments to this account."); "Returns the current " + COIN_NAME_DISPLAY + " address for receiving payments to this account.");
// Parse the account first so we don't generate a key if there's an error // Parse the account first so we don't generate a key if there's an error
string strAccount = AccountFromValue(params[0]); string strAccount = AccountFromValue(params[0]);
@@ -186,12 +188,12 @@ Value setaccount(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() < 1 || params.size() > 2) if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error( throw runtime_error(
"setaccount <casinocoinaddress> <account>\n" "setaccount <" + COIN_NAME + "address> <account>\n"
"Sets the account associated with the given address."); "Sets the account associated with the given address.");
CBitcoinAddress address(params[0].get_str()); CBitcoinAddress address(params[0].get_str());
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address");
string strAccount; string strAccount;
@@ -216,12 +218,12 @@ Value getaccount(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() != 1) if (fHelp || params.size() != 1)
throw runtime_error( throw runtime_error(
"getaccount <casinocoinaddress>\n" "getaccount <" + COIN_NAME + "address>\n"
"Returns the account associated with the given address."); "Returns the account associated with the given address.");
CBitcoinAddress address(params[0].get_str()); CBitcoinAddress address(params[0].get_str());
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address");
string strAccount; string strAccount;
map<CTxDestination, string>::iterator mi = pwalletMain->mapAddressBook.find(address.Get()); map<CTxDestination, string>::iterator mi = pwalletMain->mapAddressBook.find(address.Get());
@@ -274,13 +276,13 @@ Value sendtoaddress(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() < 2 || params.size() > 4) if (fHelp || params.size() < 2 || params.size() > 4)
throw runtime_error( throw runtime_error(
"sendtoaddress <casinocoinaddress> <amount> [comment] [comment-to]\n" "sendtoaddress <"+ COIN_NAME + "address> <amount> [comment] [comment-to]\n"
"<amount> is a real and is rounded to the nearest 0.00000001" "<amount> is a real and is rounded to the nearest 0.00000001"
+ HelpRequiringPassphrase()); + HelpRequiringPassphrase());
CBitcoinAddress address(params[0].get_str()); CBitcoinAddress address(params[0].get_str());
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid "+ COIN_NAME_DISPLAY + " address");
// Amount // Amount
int64 nAmount = AmountFromValue(params[1]); int64 nAmount = AmountFromValue(params[1]);
@@ -337,7 +339,7 @@ Value signmessage(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() != 2) if (fHelp || params.size() != 2)
throw runtime_error( throw runtime_error(
"signmessage <casinocoinaddress> <message>\n" "signmessage <"+ COIN_NAME + "address> <message>\n"
"Sign a message with the private key of an address"); "Sign a message with the private key of an address");
EnsureWalletIsUnlocked(); EnsureWalletIsUnlocked();
@@ -372,7 +374,7 @@ Value verifymessage(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() != 3) if (fHelp || params.size() != 3)
throw runtime_error( throw runtime_error(
"verifymessage <casinocoinaddress> <signature> <message>\n" "verifymessage <" + COIN_NAME + "address> <signature> <message>\n"
"Verify a signed message"); "Verify a signed message");
string strAddress = params[0].get_str(); string strAddress = params[0].get_str();
@@ -409,14 +411,14 @@ Value getreceivedbyaddress(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() < 1 || params.size() > 2) if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error( throw runtime_error(
"getreceivedbyaddress <casinocoinaddress> [minconf=1]\n" "getreceivedbyaddress <" + COIN_NAME + "address> [minconf=1]\n"
"Returns the total amount received by <casinocoinaddress> in transactions with at least [minconf] confirmations."); "Returns the total amount received by <" + COIN_NAME + "address> in transactions with at least [minconf] confirmations.");
// Bitcoin address // Bitcoin address
CBitcoinAddress address = CBitcoinAddress(params[0].get_str()); CBitcoinAddress address = CBitcoinAddress(params[0].get_str());
CScript scriptPubKey; CScript scriptPubKey;
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address");
scriptPubKey.SetDestination(address.Get()); scriptPubKey.SetDestination(address.Get());
if (!IsMine(*pwalletMain,scriptPubKey)) if (!IsMine(*pwalletMain,scriptPubKey))
return (double)0.0; return (double)0.0;
@@ -630,14 +632,14 @@ Value sendfrom(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() < 3 || params.size() > 6) if (fHelp || params.size() < 3 || params.size() > 6)
throw runtime_error( throw runtime_error(
"sendfrom <fromaccount> <tocasinocoinaddress> <amount> [minconf=1] [comment] [comment-to]\n" "sendfrom <fromaccount> <to"+ COIN_NAME + "address> <amount> [minconf=1] [comment] [comment-to]\n"
"<amount> is a real and is rounded to the nearest 0.00000001" "<amount> is a real and is rounded to the nearest 0.00000001"
+ HelpRequiringPassphrase()); + HelpRequiringPassphrase());
string strAccount = AccountFromValue(params[0]); string strAccount = AccountFromValue(params[0]);
CBitcoinAddress address(params[1].get_str()); CBitcoinAddress address(params[1].get_str());
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid CasinoCoin address"); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + COIN_NAME_DISPLAY + " address");
int64 nAmount = AmountFromValue(params[2]); int64 nAmount = AmountFromValue(params[2]);
int nMinDepth = 1; int nMinDepth = 1;
if (params.size() > 3) if (params.size() > 3)
@@ -693,7 +695,7 @@ Value sendmany(const Array& params, bool fHelp)
{ {
CBitcoinAddress address(s.name_); CBitcoinAddress address(s.name_);
if (!address.IsValid()) if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CasinoCoin address: ")+s.name_); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid " + COIN_NAME_DISPLAY + " address: ")+s.name_);
if (setAddress.count(address)) if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_); throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);
@@ -789,7 +791,7 @@ Value addmultisigaddress(const Array& params, bool fHelp)
{ {
string msg = "addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n" string msg = "addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n"
"Add a nrequired-to-sign multisignature address to the wallet\"\n" "Add a nrequired-to-sign multisignature address to the wallet\"\n"
"each key is a CasinoCoin address or hex-encoded public key\n" "each key is a " + COIN_NAME_DISPLAY + " address or hex-encoded public key\n"
"If [account] is specified, assign address to [account]."; "If [account] is specified, assign address to [account].";
throw runtime_error(msg); throw runtime_error(msg);
} }
@@ -814,7 +816,7 @@ Value createmultisig(const Array& params, bool fHelp)
string msg = "createmultisig <nrequired> <'[\"key\",\"key\"]'>\n" string msg = "createmultisig <nrequired> <'[\"key\",\"key\"]'>\n"
"Creates a multi-signature address and returns a json object\n" "Creates a multi-signature address and returns a json object\n"
"with keys:\n" "with keys:\n"
"address : casinocoin address\n" "address : " + COIN_NAME + " address\n"
"redeemScript : hex-encoded redemption script"; "redeemScript : hex-encoded redemption script";
throw runtime_error(msg); throw runtime_error(msg);
} }
@@ -1469,7 +1471,7 @@ Value encryptwallet(const Array& params, bool fHelp)
// slack space in .dat files; that is bad if the old data is // slack space in .dat files; that is bad if the old data is
// unencrypted private keys. So: // unencrypted private keys. So:
StartShutdown(); StartShutdown();
return "wallet encrypted; CasinoCoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup."; return "wallet encrypted; " + COIN_NAME_DISPLAY + " server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.";
} }
class DescribeAddressVisitor : public boost::static_visitor<Object> class DescribeAddressVisitor : public boost::static_visitor<Object>
@@ -1511,8 +1513,8 @@ Value validateaddress(const Array& params, bool fHelp)
{ {
if (fHelp || params.size() != 1) if (fHelp || params.size() != 1)
throw runtime_error( throw runtime_error(
"validateaddress <casinocoinaddress>\n" "validateaddress <"+ COIN_NAME + "address>\n"
"Return information about <casinocoinaddress>."); "Return information about <"+ COIN_NAME + "address>.");
CBitcoinAddress address(params[0].get_str()); CBitcoinAddress address(params[0].get_str());
bool isValid = address.IsValid(); bool isValid = address.IsValid();

View File

@@ -23,7 +23,7 @@ struct TestingSetup {
fPrintToDebugger = true; // don't want to write to debug.log file fPrintToDebugger = true; // don't want to write to debug.log file
noui_connect(); noui_connect();
bitdb.MakeMock(); bitdb.MakeMock();
pathTemp = GetTempPath() / strprintf("test_casinocoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); pathTemp = GetTempPath() / strprintf("test_"+ COIN_NAME + "_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
boost::filesystem::create_directories(pathTemp); boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string(); mapArgs["-datadir"] = pathTemp.string();
pblocktree = new CBlockTreeDB(1 << 20, true); pblocktree = new CBlockTreeDB(1 << 20, true);

View File

@@ -995,7 +995,7 @@ static std::string FormatException(std::exception* pex, const char* pszThread)
char pszModule[MAX_PATH] = ""; char pszModule[MAX_PATH] = "";
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule)); GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
#else #else
const char* pszModule = "casinocoin"; const char* pszModule = COIN_NAME;
#endif #endif
if (pex) if (pex)
return strprintf( return strprintf(
@@ -1037,7 +1037,7 @@ boost::filesystem::path GetDefaultDataDir()
// Unix: ~/.bitcoin // Unix: ~/.bitcoin
#ifdef WIN32 #ifdef WIN32
// Windows // Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "CasinoCoin"; return GetSpecialFolderPath(CSIDL_APPDATA) / COIN_NAME_DISPLAY;
#else #else
fs::path pathRet; fs::path pathRet;
char* pszHome = getenv("HOME"); char* pszHome = getenv("HOME");
@@ -1049,10 +1049,10 @@ boost::filesystem::path GetDefaultDataDir()
// Mac // Mac
pathRet /= "Library/Application Support"; pathRet /= "Library/Application Support";
fs::create_directory(pathRet); fs::create_directory(pathRet);
return pathRet / "CasinoCoin"; return pathRet / COIN_NAME_DISPLAY;
#else #else
// Unix // Unix
return pathRet / ".casinocoin"; return pathRet / "."+ COIN_NAME + "";
#endif #endif
#endif #endif
} }
@@ -1093,7 +1093,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
boost::filesystem::path GetConfigFile() boost::filesystem::path GetConfigFile()
{ {
boost::filesystem::path pathConfigFile(GetArg("-conf", "casinocoin.conf")); boost::filesystem::path pathConfigFile(GetArg("-conf", ""+ COIN_NAME + ".conf"));
if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile; if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile;
return pathConfigFile; return pathConfigFile;
} }
@@ -1127,7 +1127,7 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
boost::filesystem::path GetPidFile() boost::filesystem::path GetPidFile()
{ {
boost::filesystem::path pathPidFile(GetArg("-pid", "casinocoind.pid")); boost::filesystem::path pathPidFile(GetArg("-pid", ""+ COIN_NAME + "d.pid"));
if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile; if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile;
return pathPidFile; return pathPidFile;
} }
@@ -1356,7 +1356,7 @@ void AddTimeData(const CNetAddr& ip, int64 nTime)
if (!fMatch) if (!fMatch)
{ {
fDone = true; fDone = true;
string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong CasinoCoin will not work properly."); string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong ")+ COIN_NAME_DISPLAY + _(" will not work properly.");
strMiscWarning = strMessage; strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str()); printf("*** %s\n", strMessage.c_str());
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING); uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);

View File

@@ -242,7 +242,7 @@ void runCommand(std::string strCommand);
inline std::string i64tostr(int64 n) inline std::string i64tostr(int64 n)
{ {
return strprintf("%"PRI64d, n); return strprintf("%" PRI64d, n);
} }
inline std::string itostr(int n) inline std::string itostr(int n)

View File

@@ -21,6 +21,10 @@ extern const std::string CLIENT_NAME;
extern const std::string CLIENT_BUILD; extern const std::string CLIENT_BUILD;
extern const std::string CLIENT_DATE; extern const std::string CLIENT_DATE;
// Coin Name
static const std::string COIN_NAME("casinocoin");
static const std::string COIN_NAME_DISPLAY("CasinoCoin");
// //
// network protocol versioning // network protocol versioning
// //

View File

@@ -1487,7 +1487,7 @@ void CWallet::PrintWallet(const CBlock& block)
if (mapWallet.count(block.vtx[0].GetHash())) if (mapWallet.count(block.vtx[0].GetHash()))
{ {
CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()]; CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()];
printf(" mine: %d %d %"PRI64d"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); printf(" mine: %d %d %" PRI64d "", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit());
} }
} }
printf("\n"); printf("\n");
@@ -1549,7 +1549,7 @@ bool CWallet::NewKeyPool()
walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey())); walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey()));
setKeyPool.insert(nIndex); setKeyPool.insert(nIndex);
} }
printf("CWallet::NewKeyPool wrote %"PRI64d" new keys\n", nKeys); printf("CWallet::NewKeyPool wrote %" PRI64d " new keys\n", nKeys);
} }
return true; return true;
} }
@@ -1574,7 +1574,7 @@ bool CWallet::TopUpKeyPool()
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey()))) if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
throw runtime_error("TopUpKeyPool() : writing generated key failed"); throw runtime_error("TopUpKeyPool() : writing generated key failed");
setKeyPool.insert(nEnd); setKeyPool.insert(nEnd);
printf("keypool added key %"PRI64d", size=%"PRIszu"\n", nEnd, setKeyPool.size()); printf("keypool added key %" PRI64d ", size=%" PRIszu "\n", nEnd, setKeyPool.size());
} }
} }
return true; return true;
@@ -1603,7 +1603,7 @@ void CWallet::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool)
if (!HaveKey(keypool.vchPubKey.GetID())) if (!HaveKey(keypool.vchPubKey.GetID()))
throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool"); throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool");
assert(keypool.vchPubKey.IsValid()); assert(keypool.vchPubKey.IsValid());
printf("keypool reserve %"PRI64d"\n", nIndex); printf("keypool reserve %" PRI64d "\n", nIndex);
} }
} }
@@ -1630,7 +1630,7 @@ void CWallet::KeepKey(int64 nIndex)
CWalletDB walletdb(strWalletFile); CWalletDB walletdb(strWalletFile);
walletdb.ErasePool(nIndex); walletdb.ErasePool(nIndex);
} }
printf("keypool keep %"PRI64d"\n", nIndex); printf("keypool keep %" PRI64d "\n", nIndex);
} }
void CWallet::ReturnKey(int64 nIndex) void CWallet::ReturnKey(int64 nIndex)
@@ -1640,7 +1640,7 @@ void CWallet::ReturnKey(int64 nIndex)
LOCK(cs_wallet); LOCK(cs_wallet);
setKeyPool.insert(nIndex); setKeyPool.insert(nIndex);
} }
printf("keypool return %"PRI64d"\n", nIndex); printf("keypool return %" PRI64d "\n", nIndex);
} }
bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse)

View File

@@ -520,7 +520,7 @@ void ThreadFlushWalletDB(const string& strFile)
bitdb.CheckpointLSN(strFile); bitdb.CheckpointLSN(strFile);
bitdb.mapFileUseCount.erase(mi++); bitdb.mapFileUseCount.erase(mi++);
printf("Flushed wallet.dat %"PRI64d"ms\n", GetTimeMillis() - nStart); printf("Flushed wallet.dat %" PRI64d "ms\n", GetTimeMillis() - nStart);
} }
} }
} }
@@ -550,11 +550,7 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
pathDest /= wallet.strWalletFile; pathDest /= wallet.strWalletFile;
try { try {
#if BOOST_VERSION >= 104000
filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists);
#else
filesystem::copy_file(pathSrc, pathDest);
#endif
printf("copied wallet.dat to %s\n", pathDest.string().c_str()); printf("copied wallet.dat to %s\n", pathDest.string().c_str());
return true; return true;
} catch(const filesystem::filesystem_error &e) { } catch(const filesystem::filesystem_error &e) {
@@ -581,7 +577,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
// Set -rescan so any missing transactions will be // Set -rescan so any missing transactions will be
// found. // found.
int64 now = GetTime(); int64 now = GetTime();
std::string newFilename = strprintf("wallet.%"PRI64d".bak", now); std::string newFilename = strprintf("wallet.%" PRI64d ".bak", now);
int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL, int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL,
newFilename.c_str(), DB_AUTO_COMMIT); newFilename.c_str(), DB_AUTO_COMMIT);
@@ -600,7 +596,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
printf("Salvage(aggressive) found no records in %s.\n", newFilename.c_str()); printf("Salvage(aggressive) found no records in %s.\n", newFilename.c_str());
return false; return false;
} }
printf("Salvage(aggressive) found %"PRIszu" records\n", salvagedData.size()); printf("Salvage(aggressive) found %" PRIszu " records\n", salvagedData.size());
bool fSuccess = allOK; bool fSuccess = allOK;
Db* pdbCopy = new Db(&dbenv.dbenv, 0); Db* pdbCopy = new Db(&dbenv.dbenv, 0);