From 1bf59137bee8bbf4699af8010e1fc2b2f92cef4d Mon Sep 17 00:00:00 2001 From: Jannis Froese Date: Thu, 13 Mar 2014 22:48:23 +0100 Subject: Protocol changes for Dogecoin 1.5 ported over from Dogecoin and Litecoin (cherry picked from commit 8b09dad2d506fc5a6239863b1c0e33bf7e84da00) --- src/util.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'src/util.cpp') diff --git a/src/util.cpp b/src/util.cpp index 36dfd8ab7..96619f8db 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -965,7 +965,7 @@ boost::filesystem::path GetDefaultDataDir() // Unix: ~/.bitcoin #ifdef WIN32 // Windows - return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin"; + return GetSpecialFolderPath(CSIDL_APPDATA) / "Inutoshi"; #else fs::path pathRet; char* pszHome = getenv("HOME"); @@ -977,10 +977,10 @@ boost::filesystem::path GetDefaultDataDir() // Mac pathRet /= "Library/Application Support"; fs::create_directory(pathRet); - return pathRet / "Bitcoin"; + return pathRet / "Inutoshi"; #else // Unix - return pathRet / ".bitcoin"; + return pathRet / ".inutoshi"; #endif #endif } @@ -1029,7 +1029,7 @@ void ClearDatadirCache() boost::filesystem::path GetConfigFile() { - boost::filesystem::path pathConfigFile(GetArg("-conf", "bitcoin.conf")); + boost::filesystem::path pathConfigFile(GetArg("-conf", "inutoshi.conf")); if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile; return pathConfigFile; } @@ -1062,7 +1062,7 @@ void ReadConfigFile(map& mapSettingsRet, boost::filesystem::path GetPidFile() { - boost::filesystem::path pathPidFile(GetArg("-pid", "bitcoind.pid")); + boost::filesystem::path pathPidFile(GetArg("-pid", "inutoshi.pid")); if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile; return pathPidFile; } @@ -1332,6 +1332,48 @@ void seed_insecure_rand(bool fDeterministic) } } +static const long hextable[] = +{ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10-19 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 30-39 + -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, + 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, // 50-59 + -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, + 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 70-79 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, // 90-99 + 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 110-109 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 130-139 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 150-159 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 170-179 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 190-199 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 210-219 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 230-239 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1 +}; + +long hex2long(const char* hexString) +{ + long ret = 0; + + while (*hexString && ret >= 0) + { + ret = (ret << 4) | hextable[(uint8_t)*hexString++]; + } + + return ret; +} + string FormatVersion(int nVersion) { if (nVersion%100 == 0) -- cgit v1.2.3