rename xmr to monero

- rename all `xmr` to `monero`
- be insensitive while check for set currency
- add function to compate two strings insensitive
This commit is contained in:
psychocrypt
2017-10-27 20:13:19 +02:00
parent 41451d91e8
commit 12802f12e3
24 changed files with 143 additions and 101 deletions
+6 -6
View File
@@ -37,15 +37,15 @@ endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${BUILD_TYPE}")
set(XMR-STAK_CURRENCY "all" CACHE STRING "select miner currency")
set_property(CACHE XMR-STAK_CURRENCY PROPERTY STRINGS "all;xmr;aeon")
set_property(CACHE XMR-STAK_CURRENCY PROPERTY STRINGS "all;monero;aeon")
if("${XMR-STAK_CURRENCY}" STREQUAL "all")
message(STATUS "set miner currency to 'xmr' and 'aeon'")
message(STATUS "Set miner currency to 'monero' and 'aeon'")
elseif("${XMR-STAK_CURRENCY}" STREQUAL "aeon")
message(STATUS "set miner currency to 'aeon'")
add_definitions("-DCONF_NO_XMR=1")
elseif("${XMR-STAK_CURRENCY}" STREQUAL "xmr")
message(STATUS "set miner currency to 'xmr'")
message(STATUS "Set miner currency to 'aeon'")
add_definitions("-DCONF_NO_MONERO=1")
elseif("${XMR-STAK_CURRENCY}" STREQUAL "monero")
message(STATUS "Set miner currency to 'monero'")
add_definitions("-DCONF_NO_AEON=1")
endif()
+1 -1
View File
@@ -65,4 +65,4 @@ Add the binary to to protection software white list to solve this issue.s
If the miner is compiled for Monero and Aeon than you can change
- the value `currency` in the config *or*
- start the miner with the [command line option](usage.md) `--currency xmr` or `--currency aeon`
- start the miner with the [command line option](usage.md) `--currency monero` or `--currency aeon`
+1 -1
View File
@@ -47,7 +47,7 @@ After the configuration you need to compile the miner, follow the guide for your
- `WIN_UAC` will enable or disable the "Run As Administrator" prompt on Windows.
- UAC confirmation is needed to use large pages on Windows 7.
- On Windows 10 it is only needed once to set up the account to use them.
- `XMR-STAK_CURRENCY` - compile for Monero(xmr) or Aeon(aeon) usage only e.g. `cmake .. -DXMR-STAK_CURRENCY=xmr`
- `XMR-STAK_CURRENCY` - compile for Monero(XMR) or Aeon(AEON) usage only e.g. `cmake .. -DXMR-STAK_CURRENCY=monero`
## CPU Build Options
+1 -1
View File
@@ -33,7 +33,7 @@ Usage: xmr-stak [OPTION]...
-h, --help show this help
-c, --config FILE common miner configuration file
--currency NAME currency to mine: xmr or aeon
--currency NAME currency to mine: monero or aeon
--noCPU disable the CPU miner backend
--cpu FILE CPU backend miner config file
--noAMD disable the AMD miner backend
+6 -6
View File
@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../cryptonight.hpp"
#include "../../../jconf.hpp"
#include "xmrstak/backend/cryptonight.hpp"
#include "xmrstak/jconf.hpp"
#include <stdio.h>
#include <string.h>
@@ -251,11 +251,11 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
size_t hashMemSize;
int threadMemMask;
int hasIterations;
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
threadMemMask = XMR_MASK;
hasIterations = XMR_ITER;
hashMemSize = MONERO_MEMORY;
threadMemMask = MONERO_MASK;
hasIterations = MONERO_ITER;
}
else
{
+4 -4
View File
@@ -8,8 +8,8 @@
#include "xmrstak/misc/console.hpp"
#include "xmrstak/misc/configEditor.hpp"
#include "xmrstak/params.hpp"
#include "../cryptonight.hpp"
#include "../../jconf.hpp"
#include "xmrstak/backend/cryptonight.hpp"
#include "xmrstak/jconf.hpp"
#include <vector>
#include <cstdio>
@@ -84,9 +84,9 @@ private:
constexpr size_t byteToMiB = 1024u * 1024u;
size_t hashMemSize;
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
hashMemSize = MONERO_MEMORY;
}
else
{
+1 -1
View File
@@ -183,7 +183,7 @@ void minethd::work_main()
uint64_t iCount = 0;
cryptonight_ctx* cpu_ctx;
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, ::jconf::inst()->IsCurrencyXMR());
cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, ::jconf::inst()->IsCurrencyMonero());
globalStates::inst().iConsumeCnt++;
while (bQuit == 0)
+3 -3
View File
@@ -6,7 +6,7 @@
#include "xmrstak/jconf.hpp"
#include "xmrstak/misc/configEditor.hpp"
#include "xmrstak/params.hpp"
#include "../cryptonight.hpp"
#include "xmrstak/backend/cryptonight.hpp"
#include <string>
#ifdef _WIN32
@@ -38,9 +38,9 @@ public:
autoAdjust()
{
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
hashMemSize = MONERO_MEMORY;
halfHashMemSize = hashMemSize / 2u;
}
else
+3 -3
View File
@@ -3,7 +3,7 @@
#include "xmrstak/misc/console.hpp"
#include "xmrstak/misc/configEditor.hpp"
#include "xmrstak/params.hpp"
#include "../cryptonight.hpp"
#include "xmrstak/backend/cryptonight.hpp"
#ifdef _WIN32
#include <windows.h>
@@ -28,9 +28,9 @@ public:
autoAdjust()
{
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
hashMemSize = MONERO_MEMORY;
halfHashMemSize = hashMemSize / 2u;
}
else
+1 -1
View File
@@ -7,7 +7,7 @@ extern "C" {
#include <stddef.h>
#include <inttypes.h>
#include "../../cryptonight.hpp"
#include "xmrstak/backend/cryptonight.hpp"
typedef struct {
@@ -30,8 +30,8 @@ extern "C"
}
#include "cryptonight.h"
#include "cryptonight_aesni.h"
#include "../../../jconf.hpp"
#include "../../cryptonight.hpp"
#include "xmrstak/backend/cryptonight.hpp"
#include "xmrstak/jconf.hpp"
#include <stdio.h>
#include <stdlib.h>
@@ -197,9 +197,9 @@ size_t cryptonight_init(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg)
cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg)
{
size_t hashMemSize;
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
hashMemSize = MONERO_MEMORY;
}
else
{
@@ -277,9 +277,9 @@ cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, al
void cryptonight_free_ctx(cryptonight_ctx* ctx)
{
size_t hashMemSize;
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
hashMemSize = MONERO_MEMORY;
}
else
{
+36 -30
View File
@@ -201,28 +201,28 @@ bool minethd::self_test()
bool bResult = true;
bool useXmr = ::jconf::inst()->IsCurrencyXMR();
if(useXmr)
bool mineMonero = ::jconf::inst()->IsCurrencyMonero();
if(mineMonero)
{
unsigned char out[64];
cn_hash_fun hashf;
cn_hash_fun_dbl hashdf;
hashf = func_selector(::jconf::inst()->HaveHardwareAes(), false, useXmr);
hashf = func_selector(::jconf::inst()->HaveHardwareAes(), false, mineMonero);
hashf("This is a test", 14, out, ctx0);
bResult = memcmp(out, "\xa0\x84\xf0\x1d\x14\x37\xa0\x9c\x69\x85\x40\x1b\x60\xd4\x35\x54\xae\x10\x58\x02\xc5\xf5\xd8\xa9\xb3\x25\x36\x49\xc0\xbe\x66\x05", 32) == 0;
hashf = func_selector(::jconf::inst()->HaveHardwareAes(), true, useXmr);
hashf = func_selector(::jconf::inst()->HaveHardwareAes(), true, mineMonero);
hashf("This is a test", 14, out, ctx0);
bResult &= memcmp(out, "\xa0\x84\xf0\x1d\x14\x37\xa0\x9c\x69\x85\x40\x1b\x60\xd4\x35\x54\xae\x10\x58\x02\xc5\xf5\xd8\xa9\xb3\x25\x36\x49\xc0\xbe\x66\x05", 32) == 0;
hashdf = func_dbl_selector(::jconf::inst()->HaveHardwareAes(), false, useXmr);
hashdf = func_dbl_selector(::jconf::inst()->HaveHardwareAes(), false, mineMonero);
hashdf("The quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy log", 43, out, ctx0, ctx1);
bResult &= memcmp(out, "\x3e\xbb\x7f\x9f\x7d\x27\x3d\x7c\x31\x8d\x86\x94\x77\x55\x0c\xc8\x00\xcf\xb1\x1b\x0c\xad\xb7\xff\xbd\xf6\xf8\x9f\x3a\x47\x1c\x59"
"\xb4\x77\xd5\x02\xe4\xd8\x48\x7f\x42\xdf\xe3\x8e\xed\x73\x81\x7a\xda\x91\xb7\xe2\x63\xd2\x91\x71\xb6\x5c\x44\x3a\x01\x2a\x41\x22", 64) == 0;
hashdf = func_dbl_selector(::jconf::inst()->HaveHardwareAes(), true, useXmr);
hashdf = func_dbl_selector(::jconf::inst()->HaveHardwareAes(), true, mineMonero);
hashdf("The quick brown fox jumps over the lazy dogThe quick brown fox jumps over the lazy log", 43, out, ctx0, ctx1);
bResult &= memcmp(out, "\x3e\xbb\x7f\x9f\x7d\x27\x3d\x7c\x31\x8d\x86\x94\x77\x55\x0c\xc8\x00\xcf\xb1\x1b\x0c\xad\xb7\xff\xbd\xf6\xf8\x9f\x3a\x47\x1c\x59"
"\xb4\x77\xd5\x02\xe4\xd8\x48\x7f\x42\xdf\xe3\x8e\xed\x73\x81\x7a\xda\x91\xb7\xe2\x63\xd2\x91\x71\xb6\x5c\x44\x3a\x01\x2a\x41\x22", 64) == 0;
@@ -289,7 +289,7 @@ void minethd::consume_work()
globalStates::inst().inst().iConsumeCnt++;
}
minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch, bool useXMR)
minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch, bool mineMonero)
{
// We have two independent flag bits in the functions
// therefore we will build a binary digit and select the
@@ -297,13 +297,17 @@ minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch, boo
// Digit order SOFT_AES, NO_PREFETCH, MINER_ALGO
static const cn_hash_fun func_table[] = {
#ifndef CONF_NO_XMR
cryptonight_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, false, false>,
cryptonight_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, false, true>,
cryptonight_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, true, false>,
cryptonight_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, true, true>
/* there will be 8 function entries if `CONF_NO_MONERO` and `CONF_NO_AEON`
* is not defined. If one is defined there will be 4 entries.
*/
#ifndef CONF_NO_MONERO
cryptonight_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, false, false>,
cryptonight_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, false, true>,
cryptonight_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, true, false>,
cryptonight_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, true, true>
#endif
#if (!defined(CONF_NO_AEON)) && (!defined(CONF_NO_XMR))
#if (!defined(CONF_NO_AEON)) && (!defined(CONF_NO_MONERO))
// comma will be added only if Monero and Aeon is build
,
#endif
#ifndef CONF_NO_AEON
@@ -317,14 +321,13 @@ minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch, boo
std::bitset<3> digit;
digit.set(0, !bNoPrefetch);
digit.set(1, !bHaveAes);
//miner algo true = XMR, false = AEON
digit.set(2, useXMR);
// define aeon settings
#if defined(CONF_NO_AEON) || defined(CONF_NO_XMR)
#if defined(CONF_NO_AEON) || defined(CONF_NO_MONERO)
// ignore 3rd bit if only on currency is active
digit.set(2, 0);
#else
digit.set(2, !useXMR);
digit.set(2, !mineMonero);
#endif
return func_table[digit.to_ulong()];
@@ -344,7 +347,7 @@ void minethd::work_main()
uint32_t* piNonce;
job_result result;
hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, ::jconf::inst()->IsCurrencyXMR());
hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, ::jconf::inst()->IsCurrencyMonero());
ctx = minethd_alloc_ctx();
piHashVal = (uint64_t*)(result.bResult + 24);
@@ -406,7 +409,7 @@ void minethd::work_main()
cryptonight_free_ctx(ctx);
}
minethd::cn_hash_fun_dbl minethd::func_dbl_selector(bool bHaveAes, bool bNoPrefetch, bool useXMR)
minethd::cn_hash_fun_dbl minethd::func_dbl_selector(bool bHaveAes, bool bNoPrefetch, bool mineMonero)
{
// We have two independent flag bits in the functions
// therefore we will build a binary digit and select the
@@ -414,13 +417,17 @@ minethd::cn_hash_fun_dbl minethd::func_dbl_selector(bool bHaveAes, bool bNoPrefe
// Digit order SOFT_AES, NO_PREFETCH, MINER_ALGO
static const cn_hash_fun_dbl func_table[] = {
#ifndef CONF_NO_XMR
cryptonight_double_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, false, false>,
cryptonight_double_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, false, true>,
cryptonight_double_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, true, false>,
cryptonight_double_hash<XMR_MASK, XMR_ITER, XMR_MEMORY, true, true>
/* there will be 8 function entries if `CONF_NO_MONERO` and `CONF_NO_AEON`
* is not defined. If one is defined there will be 4 entries.
*/
#ifndef CONF_NO_MONERO
cryptonight_double_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, false, false>,
cryptonight_double_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, false, true>,
cryptonight_double_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, true, false>,
cryptonight_double_hash<MONERO_MASK, MONERO_ITER, MONERO_MEMORY, true, true>
#endif
#if (!defined(CONF_NO_AEON)) && (!defined(CONF_NO_XMR))
#if (!defined(CONF_NO_AEON)) && (!defined(CONF_NO_MONERO))
// comma will be added only if Monero and Aeon is build
,
#endif
#ifndef CONF_NO_AEON
@@ -434,14 +441,13 @@ minethd::cn_hash_fun_dbl minethd::func_dbl_selector(bool bHaveAes, bool bNoPrefe
std::bitset<3> digit;
digit.set(0, !bNoPrefetch);
digit.set(1, !bHaveAes);
//miner algo true = XMR, false = AEON
digit.set(2, useXMR);
// define aeon settings
#if defined(CONF_NO_AEON) || defined(CONF_NO_XMR)
#if defined(CONF_NO_AEON) || defined(CONF_NO_MONERO)
// ignore 3rd bit if only on currency is active
digit.set(2, 0);
#else
digit.set(2, !useXMR);
digit.set(2, !mineMonero);
#endif
return func_table[digit.to_ulong()];
@@ -472,7 +478,7 @@ void minethd::double_work_main()
uint32_t iNonce;
job_result res;
hash_fun = func_dbl_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, ::jconf::inst()->IsCurrencyXMR());
hash_fun = func_dbl_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, ::jconf::inst()->IsCurrencyMonero());
ctx0 = minethd_alloc_ctx();
ctx1 = minethd_alloc_ctx();
+2 -2
View File
@@ -23,7 +23,7 @@ public:
typedef void (*cn_hash_fun)(const void*, size_t, void*, cryptonight_ctx*);
static cn_hash_fun func_selector(bool bHaveAes, bool bNoPrefetch, bool useXMR);
static cn_hash_fun func_selector(bool bHaveAes, bool bNoPrefetch, bool mineMonero);
static bool thd_setaffinity(std::thread::native_handle_type h, uint64_t cpu_id);
static cryptonight_ctx* minethd_alloc_ctx();
@@ -31,7 +31,7 @@ public:
private:
typedef void (*cn_hash_fun_dbl)(const void*, size_t, void*, cryptonight_ctx* __restrict, cryptonight_ctx* __restrict);
static cn_hash_fun_dbl func_dbl_selector(bool bHaveAes, bool bNoPrefetch, bool useXMR);
static cn_hash_fun_dbl func_dbl_selector(bool bHaveAes, bool bNoPrefetch, bool mineMonero);
minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefetch, int64_t affinity);
+3 -3
View File
@@ -6,7 +6,7 @@
#define AEON_ITER 0x40000
// define xmr settings
#define XMR_MEMORY 2097152llu
#define XMR_MASK 0x1FFFF0
#define XMR_ITER 0x80000
#define MONERO_MEMORY 2097152llu
#define MONERO_MASK 0x1FFFF0
#define MONERO_ITER 0x80000
+9 -8
View File
@@ -32,7 +32,8 @@
#include "xmrstak/jconf.hpp"
#include "xmrstak/misc/environment.hpp"
#include "xmrstak/backend/cpu/hwlocMemory.hpp"
#include "../cryptonight.hpp"
#include "xmrstak/backend/cryptonight.hpp"
#include "xmrstak/misc/utility.hpp"
#include <assert.h>
#include <cmath>
@@ -209,7 +210,7 @@ void minethd::work_main()
uint64_t iCount = 0;
cryptonight_ctx* cpu_ctx;
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, ::jconf::inst()->IsCurrencyXMR());
cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, ::jconf::inst()->IsCurrencyMonero());
uint32_t iNonce;
globalStates::inst().iConsumeCnt++;
@@ -220,8 +221,8 @@ void minethd::work_main()
std::exit(0);
}
bool useXMR = ::jconf::inst()->GetCurrency().compare("xmr") == 0;
bool useAEON = ::jconf::inst()->GetCurrency().compare("aeon") == 0;
bool mineMonero = strcmp_i(::jconf::inst()->GetCurrency(), "monero");
bool useAEON = strcmp_i(::jconf::inst()->GetCurrency(), "aeon");
while (bQuit == 0)
{
@@ -260,16 +261,16 @@ void minethd::work_main()
uint32_t foundCount;
cryptonight_extra_cpu_prepare(&ctx, iNonce);
#ifndef CONF_NO_XMR
if(useXMR)
#ifndef CONF_NO_MONERO
if(mineMonero)
{
cryptonight_core_cpu_hash<XMR_ITER, XMR_MASK, 19>(&ctx);
cryptonight_core_cpu_hash<MONERO_ITER, MONERO_MASK, 19>(&ctx);
}
#endif
#ifndef CONF_NO_AEON
if(useAEON)
{
cryptonight_core_cpu_hash<XMR_ITER, XMR_MASK, 18>(&ctx);
cryptonight_core_cpu_hash<MONERO_ITER, MONERO_MASK, 18>(&ctx);
}
#endif
cryptonight_extra_cpu_final(&ctx, iNonce, oWork.iTarget, &foundCount, foundNonce);
@@ -5,7 +5,7 @@
#include <cuda_runtime.h>
#include <device_functions.hpp>
#include <algorithm>
#include "../../../jconf.hpp"
#include "xmrstak/jconf.hpp"
#ifdef __CUDACC__
__constant__
@@ -190,9 +190,9 @@ extern "C" int cryptonight_extra_cpu_init(nvid_ctx* ctx)
cudaDeviceSetCacheConfig(cudaFuncCachePreferL1);
size_t hashMemSize;
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
hashMemSize = MONERO_MEMORY;
}
else
{
@@ -355,9 +355,9 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx)
ctx->free_device_memory = freeMemory;
size_t hashMemSize;
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
hashMemSize = XMR_MEMORY;
hashMemSize = MONERO_MEMORY;
}
else
{
@@ -1,6 +1,6 @@
#pragma once
#include "../../cryptonight.hpp"
#include "xmrstak/backend/cryptonight.hpp"
#ifdef __INTELLISENSE__
#define __CUDA_ARCH__ 520
+10 -9
View File
@@ -31,6 +31,7 @@
#include "xmrstak/params.hpp"
#include "xmrstak/misc/configEditor.hpp"
#include "xmrstak/version.hpp"
#include "xmrstak/misc/utility.hpp"
#ifndef CONF_NO_HTTPD
# include "xmrstak/http/httpd.hpp"
@@ -64,8 +65,8 @@ void help()
cout<<" "<<endl;
cout<<" -h, --help show this help"<<endl;
cout<<" -c, --config FILE common miner configuration file"<<endl;
#if (!defined(CONF_NO_AEON)) && (!defined(CONF_NO_XMR))
cout<<" --currency NAME currency to mine: xmr or aeon"<<endl;
#if (!defined(CONF_NO_AEON)) && (!defined(CONF_NO_MONERO))
cout<<" --currency NAME currency to mine: monero or aeon"<<endl;
#endif
#ifndef CONF_NO_CPU
cout<<" --noCPU disable the CPU miner backend"<<endl;
@@ -250,13 +251,13 @@ int main(int argc, char *argv[])
{
std::string tmp;
#if defined(CONF_NO_AEON)
tmp = "xmr";
#elif defined(CONF_NO_XMR)
tmp = "monero";
#elif defined(CONF_NO_MONERO)
tmp = "aeon";
#endif
while(tmp.compare("xmr") != 0 && tmp.compare("aeon") != 0)
while(xmrstak::strcmp_i(tmp, "monero") && xmrstak::strcmp_i(tmp, "aeon"))
{
std::cout<<"- currency: 'xmr' or 'aeon'"<<std::endl;
std::cout<<"- currency: 'monero' or 'aeon'"<<std::endl;
std::cin >> tmp;
}
currency = tmp;
@@ -264,7 +265,7 @@ int main(int argc, char *argv[])
auto& pool = params::inst().poolURL;
if(pool.empty())
{
if(currency.compare("xmr") != 0)
if(xmrstak::strcmp_i(currency, "monero"))
std::cout<<"- pool address: e.g. pool.usxmrpool.com:3333"<<std::endl;
else
std::cout<<"- pool address: e.g. mine.aeon-pool.com:5555"<<std::endl;
@@ -333,8 +334,8 @@ int main(int argc, char *argv[])
printer::inst()->print_str("'r' - results\n");
printer::inst()->print_str("'c' - connection\n");
printer::inst()->print_str("-------------------------------------------------------------------\n");
if(::jconf::inst()->IsCurrencyXMR())
printer::inst()->print_msg(L0,"Start mining: XMR");
if(::jconf::inst()->IsCurrencyMonero())
printer::inst()->print_msg(L0,"Start mining: MONERO");
else
printer::inst()->print_msg(L0,"Start mining: AEON");
+1 -1
View File
@@ -12,7 +12,7 @@ R"===(
/*
* currency to mine
* allowed values: 'xmr' or 'aeon'
* allowed values: 'monero' or 'aeon'
*/
"currency" : "CURRENCY",
+6 -5
View File
@@ -27,6 +27,7 @@
#include "xmrstak/misc/console.hpp"
#include "xmrstak/misc/jext.hpp"
#include "xmrstak/misc/console.hpp"
#include "xmrstak/misc/utility.hpp"
#include <stdio.h>
#include <stdlib.h>
@@ -157,14 +158,14 @@ const std::string jconf::GetCurrency()
if(currency.empty())
currency = prv->configValues[sCurrency]->GetString();
if(
#ifndef CONF_NO_XMR
currency.compare("xmr") != 0
#ifndef CONF_NO_MONERO
xmrstak::strcmp_i(currency, "monero")
#else
true
#endif
&&
#ifndef CONF_NO_AEON
currency.compare("aeon") != 0
xmrstak::strcmp_i(currency, "aeon")
#else
true
#endif
@@ -176,9 +177,9 @@ const std::string jconf::GetCurrency()
return currency;
}
bool jconf::IsCurrencyXMR()
bool jconf::IsCurrencyMonero()
{
if(::jconf::inst()->GetCurrency().compare("xmr") == 0)
if(xmrstak::strcmp_i(::jconf::inst()->GetCurrency(), "monero"))
{
return true;
}
+1 -1
View File
@@ -42,7 +42,7 @@ public:
const char* GetPoolPwd();
const char* GetWalletAddress();
const std::string GetCurrency();
bool IsCurrencyXMR();
bool IsCurrencyMonero();
uint64_t GetVerboseLevel();
uint64_t GetAutohashTime();
+3 -3
View File
@@ -21,7 +21,7 @@
*
*/
#include "../jconf.hpp"
#include "xmrstak/jconf.hpp"
#include "executor.hpp"
#include "xmrstak/net/jpsock.hpp"
@@ -184,7 +184,7 @@ void executor::on_sock_ready(size_t pool_id)
if(pool_id == dev_pool_id)
{
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
{
if(!pool->cmd_login("", ""))
pool->disconnect();
@@ -362,7 +362,7 @@ void executor::on_switch_pool(size_t pool_id)
// as we never receive further events
printer::inst()->print_msg(L1, "Connecting to dev pool...");
std::string dev_pool_addr;
if(::jconf::inst()->IsCurrencyXMR())
if(::jconf::inst()->IsCurrencyMonero())
dev_pool_addr = jconf::inst()->GetTlsSetting() ? "donate.xmr-stak.net:6666" : "donate.xmr-stak.net:3333";
else
dev_pool_addr = jconf::inst()->GetTlsSetting() ? "mine.aeon-pool.com:443" : "mine.aeon-pool.com:5555";
+21
View File
@@ -0,0 +1,21 @@
#include <string>
#include <algorithm>
namespace xmrstak
{
bool strcmp_i(const std::string& str1, const std::string& str2)
{
if(str1.size() != str2.size())
return false;
else
return (str1.empty() | str2.empty()) ?
false :
std::equal(str1.begin(), str1.end(),str2.begin(),
[](char c1, char c2)
{
return ::tolower(c1) == ::tolower(c2);
}
);
}
} // namepsace xmrstak
+12
View File
@@ -0,0 +1,12 @@
#pragma once
#include <string>
namespace xmrstak
{
/** case insensitive string compare
*
* @return true if both strings are equal, else false
*/
bool strcmp_i(const std::string& str1, const std::string& str2);
} // namepsace xmrstak