summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpsychocrypt <psychocryptHPC@gmail.com>2018-02-12 20:17:52 +0100
committerGitHub <noreply@github.com>2018-02-12 20:17:52 +0100
commit29bac54912faa1090f34f3fb5e23cb018f2c36e1 (patch)
treef9210dc0fdc4ef1dbe8d64b18060a82fe100304f
parent560e9e5e9dd2bd5e29bcb69eac9d8cac0cc98e90 (diff)
parent40e40b557a58094b9c16d0cadacf94c3bf6a6658 (diff)
downloadxmr-stak-29bac54912faa1090f34f3fb5e23cb018f2c36e1.zip
xmr-stak-29bac54912faa1090f34f3fb5e23cb018f2c36e1.tar.gz
Merge pull request #1062 from fireice-uk/topic-rigid
Add rig identifier
-rw-r--r--xmrstak/cli/cli-miner.cpp49
-rw-r--r--xmrstak/config.tpl1
-rw-r--r--xmrstak/jconf.cpp8
-rw-r--r--xmrstak/jconf.hpp1
-rw-r--r--xmrstak/misc/executor.cpp15
-rw-r--r--xmrstak/net/jpsock.cpp8
-rw-r--r--xmrstak/net/jpsock.hpp3
-rw-r--r--xmrstak/params.hpp2
8 files changed, 66 insertions, 21 deletions
diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp
index 7dc0f2f..29c56b2 100644
--- a/xmrstak/cli/cli-miner.cpp
+++ b/xmrstak/cli/cli-miner.cpp
@@ -95,6 +95,7 @@ void help()
cout<<" -o, --url URL pool url and port, e.g. pool.usxmrpool.com:3333"<<endl;
cout<<" -O, --tls-url URL TLS pool url and port, e.g. pool.usxmrpool.com:10443"<<endl;
cout<<" -u, --user USERNAME pool user name or wallet address"<<endl;
+ cout<<" -r, --rigid RIGID rig identifier for pool-side statistics (needs pool support)"<<endl;
cout<<" -p, --pass PASSWD pool password, in the most cases x or empty \"\""<<endl;
cout<<" --use-nicehash the pool should run in nicehash mode"<<endl;
cout<<" \n"<<endl;
@@ -146,6 +147,11 @@ std::string get_multipool_entry(bool& final)
std::cin.clear(); std::cin.ignore(INT_MAX,'\n');
std::cout<<"- Password (mostly empty or x):"<<std::endl;
getline(std::cin, passwd);
+
+ std::string rigid;
+ std::cin.clear(); std::cin.ignore(INT_MAX,'\n');
+ std::cout<<"- Rig identifier for pool-side statistics (needs pool support). Can be empty:"<<std::endl;
+ getline(std::cin, rigid);
#ifdef CONF_NO_TLS
bool tls = false;
@@ -165,9 +171,9 @@ std::string get_multipool_entry(bool& final)
final = !read_yes_no("- Do you want to add another pool? (y/n)");
- return "\t{\"pool_address\" : \"" + pool +"\", \"wallet_address\" : \"" + userName + "\", \"pool_password\" : \"" +
- passwd + "\", \"use_nicehash\" : " + bool_to_str(nicehash) + ", \"use_tls\" : " + bool_to_str(tls) +
- ", \"tls_fingerprint\" : \"\", \"pool_weight\" : " + std::to_string(pool_weight) + " },\n";
+ return "\t{\"pool_address\" : \"" + pool +"\", \"wallet_address\" : \"" + userName + "\", \"rig_id\" : \"" + rigid +
+ "\", \"pool_password\" : \"" + passwd + "\", \"use_nicehash\" : " + bool_to_str(nicehash) + ", \"use_tls\" : " +
+ bool_to_str(tls) + ", \"tls_fingerprint\" : \"\", \"pool_weight\" : " + std::to_string(pool_weight) + " },\n";
}
inline void prompt_once(bool& prompted)
@@ -268,6 +274,17 @@ void do_guided_config()
getline(std::cin, passwd);
}
+ auto& rigid = params::inst().poolRigid;
+ if(rigid.empty() && !params::inst().userSetRigid)
+ {
+ prompt_once(prompted);
+
+ // clear everything from stdin to allow an empty rigid
+ std::cin.clear(); std::cin.ignore(INT_MAX,'\n');
+ std::cout<<"- Rig identifier for pool-side statistics (needs pool support). Can be empty:"<<std::endl;
+ getline(std::cin, rigid);
+ }
+
bool tls;
#ifdef CONF_NO_TLS
tls = false;
@@ -315,9 +332,9 @@ void do_guided_config()
pool_weight = 1;
std::string pool_table;
- pool_table += "\t{\"pool_address\" : \"" + pool +"\", \"wallet_address\" : \"" + userName + "\", \"pool_password\" : \"" +
- passwd + "\", \"use_nicehash\" : " + bool_to_str(nicehash) + ", \"use_tls\" : " + bool_to_str(tls) +
- ", \"tls_fingerprint\" : \"\", \"pool_weight\" : " + std::to_string(pool_weight) + " },\n";
+ pool_table += "\t{\"pool_address\" : \"" + pool +"\", \"wallet_address\" : \"" + userName + "\", \"rig_id\" : \"" + rigid +
+ "\", \"pool_password\" : \"" + passwd + "\", \"use_nicehash\" : " + bool_to_str(nicehash) + ", \"use_tls\" : " +
+ bool_to_str(tls) + ", \"tls_fingerprint\" : \"\", \"pool_weight\" : " + std::to_string(pool_weight) + " },\n";
if(multipool)
{
@@ -522,6 +539,26 @@ int main(int argc, char *argv[])
params::inst().userSetPwd = true;
params::inst().poolPasswd = argv[i];
}
+ else if(opName.compare("-r") == 0 || opName.compare("--rigid") == 0)
+ {
+ if(!pool_url_set)
+ {
+ printer::inst()->print_msg(L0, "Pool address has to be set if you want to specify rigid.");
+ win_exit();
+ return 1;
+ }
+
+ ++i;
+ if( i >=argc )
+ {
+ printer::inst()->print_msg(L0, "No argument for parameter '-r/--rigid' given");
+ win_exit();
+ return 1;
+ }
+
+ params::inst().userSetRigid = true;
+ params::inst().poolRigid = argv[i];
+ }
else if(opName.compare("--use-nicehash") == 0)
{
params::inst().nicehashMode = true;
diff --git a/xmrstak/config.tpl b/xmrstak/config.tpl
index 2c7bd41..451ea7b 100644
--- a/xmrstak/config.tpl
+++ b/xmrstak/config.tpl
@@ -2,6 +2,7 @@ R"===(
/*
* pool_address - Pool address should be in the form "pool.supportxmr.com:3333". Only stratum pools are supported.
* wallet_address - Your wallet, or pool login.
+ * rig_id - Rig identifier for pool-side statistics (needs pool support).
* pool_password - Can be empty in most cases or "x".
* use_nicehash - Limit the nonce to 3 bytes as required by nicehash.
* use_tls - This option will make us connect using Transport Layer Security.
diff --git a/xmrstak/jconf.cpp b/xmrstak/jconf.cpp
index a1db451..c9d3a20 100644
--- a/xmrstak/jconf.cpp
+++ b/xmrstak/jconf.cpp
@@ -129,12 +129,13 @@ bool jconf::GetPoolConfig(size_t id, pool_cfg& cfg)
return false;
typedef const Value* cval;
- cval jaddr, jlogin, jpasswd, jnicehash, jtls, jtlsfp, jwt;
+ cval jaddr, jlogin, jrigid, jpasswd, jnicehash, jtls, jtlsfp, jwt;
const Value& oThdConf = prv->configValues[aPoolList]->GetArray()[id];
/* We already checked presence and types */
jaddr = GetObjectMember(oThdConf, "pool_address");
jlogin = GetObjectMember(oThdConf, "wallet_address");
+ jrigid = GetObjectMember(oThdConf, "rig_id");
jpasswd = GetObjectMember(oThdConf, "pool_password");
jnicehash = GetObjectMember(oThdConf, "use_nicehash");
jtls = GetObjectMember(oThdConf, "use_tls");
@@ -143,6 +144,7 @@ bool jconf::GetPoolConfig(size_t id, pool_cfg& cfg)
cfg.sPoolAddr = jaddr->GetString();
cfg.sWalletAddr = jlogin->GetString();
+ cfg.sRigId = jrigid->GetString();
cfg.sPasswd = jpasswd->GetString();
cfg.nicehash = jnicehash->GetBool();
cfg.tls = jtls->GetBool();
@@ -420,8 +422,8 @@ bool jconf::parse_config(const char* sFilename)
std::vector<size_t> pool_weights;
pool_weights.reserve(pool_cnt);
- const char* aPoolValues[] = { "pool_address", "wallet_address", "pool_password", "use_nicehash", "use_tls", "tls_fingerprint", "pool_weight" };
- Type poolValTypes[] = { kStringType, kStringType, kStringType, kTrueType, kTrueType, kStringType, kNumberType };
+ const char* aPoolValues[] = { "pool_address", "wallet_address", "rig_id", "pool_password", "use_nicehash", "use_tls", "tls_fingerprint", "pool_weight" };
+ Type poolValTypes[] = { kStringType, kStringType, kStringType, kStringType, kTrueType, kTrueType, kStringType, kNumberType };
constexpr size_t pvcnt = sizeof(aPoolValues)/sizeof(aPoolValues[0]);
for(uint32_t i=0; i < pool_cnt; i++)
diff --git a/xmrstak/jconf.hpp b/xmrstak/jconf.hpp
index df1bf79..9a4e958 100644
--- a/xmrstak/jconf.hpp
+++ b/xmrstak/jconf.hpp
@@ -23,6 +23,7 @@ public:
struct pool_cfg {
const char* sPoolAddr;
const char* sWalletAddr;
+ const char* sRigId;
const char* sPasswd;
bool nicehash;
bool tls;
diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp
index 055739b..c4ba26e 100644
--- a/xmrstak/misc/executor.cpp
+++ b/xmrstak/misc/executor.cpp
@@ -518,13 +518,14 @@ void executor::ex_main()
already_have_cli_pool = true;
const char* wallet = params.poolUsername.empty() ? cfg.sWalletAddr : params.poolUsername.c_str();
+ const char* rigid = params.userSetRigid ? params.poolRigid.c_str() : cfg.sRigId;
const char* pwd = params.userSetPwd ? params.poolPasswd.c_str() : cfg.sPasswd;
bool nicehash = cfg.nicehash || params.nicehashMode;
- pools.emplace_back(i+1, cfg.sPoolAddr, wallet, pwd, 9.9, false, params.poolUseTls, cfg.tls_fingerprint, nicehash);
+ pools.emplace_back(i+1, cfg.sPoolAddr, wallet, rigid, pwd, 9.9, false, params.poolUseTls, cfg.tls_fingerprint, nicehash);
}
else
- pools.emplace_back(i+1, cfg.sPoolAddr, cfg.sWalletAddr, cfg.sPasswd, cfg.weight, false, cfg.tls, cfg.tls_fingerprint, cfg.nicehash);
+ pools.emplace_back(i+1, cfg.sPoolAddr, cfg.sWalletAddr, cfg.sRigId, cfg.sPasswd, cfg.weight, false, cfg.tls, cfg.tls_fingerprint, cfg.nicehash);
}
if(!xmrstak::params::inst().poolURL.empty() && !already_have_cli_pool)
@@ -536,22 +537,22 @@ void executor::ex_main()
win_exit();
}
- pools.emplace_back(i+1, params.poolURL.c_str(), params.poolUsername.c_str(), params.poolPasswd.c_str(), 9.9, false, params.poolUseTls, "", params.nicehashMode);
+ pools.emplace_back(i+1, params.poolURL.c_str(), params.poolUsername.c_str(), params.poolRigid.c_str(), params.poolPasswd.c_str(), 9.9, false, params.poolUseTls, "", params.nicehashMode);
}
if(jconf::inst()->IsCurrencyMonero())
{
if(dev_tls)
- pools.emplace_front(0, "donate.xmr-stak.net:6666", "", "", 0.0, true, true, "", false);
+ pools.emplace_front(0, "donate.xmr-stak.net:6666", "", "", "", 0.0, true, true, "", false);
else
- pools.emplace_front(0, "donate.xmr-stak.net:3333", "", "", 0.0, true, false, "", false);
+ pools.emplace_front(0, "donate.xmr-stak.net:3333", "", "", "", 0.0, true, false, "", false);
}
else
{
if(dev_tls)
- pools.emplace_front(0, "donate.xmr-stak.net:7777", "", "", 0.0, true, true, "", true);
+ pools.emplace_front(0, "donate.xmr-stak.net:7777", "", "", "", 0.0, true, true, "", true);
else
- pools.emplace_front(0, "donate.xmr-stak.net:4444", "", "", 0.0, true, false, "", true);
+ pools.emplace_front(0, "donate.xmr-stak.net:4444", "", "", "", 0.0, true, false, "", true);
}
ex_event ev;
diff --git a/xmrstak/net/jpsock.cpp b/xmrstak/net/jpsock.cpp
index 7ee09e7..9c413dc 100644
--- a/xmrstak/net/jpsock.cpp
+++ b/xmrstak/net/jpsock.cpp
@@ -92,8 +92,8 @@ struct jpsock::opq_json_val
opq_json_val(const Value* val) : val(val) {}
};
-jpsock::jpsock(size_t id, const char* sAddr, const char* sLogin, const char* sPassword, double pool_weight, bool dev_pool, bool tls, const char* tls_fp, bool nicehash) :
- net_addr(sAddr), usr_login(sLogin), usr_pass(sPassword), tls_fp(tls_fp), pool_id(id), pool_weight(pool_weight), pool(dev_pool), nicehash(nicehash),
+jpsock::jpsock(size_t id, const char* sAddr, const char* sLogin, const char* sRigId, const char* sPassword, double pool_weight, bool dev_pool, bool tls, const char* tls_fp, bool nicehash) :
+ net_addr(sAddr), usr_login(sLogin), usr_rigid(sRigId), usr_pass(sPassword), tls_fp(tls_fp), pool_id(id), pool_weight(pool_weight), pool(dev_pool), nicehash(nicehash),
connect_time(0), connect_attempts(0), disconnect_time(0), quiet_close(false)
{
sock_init();
@@ -523,8 +523,8 @@ bool jpsock::cmd_login()
{
char cmd_buffer[1024];
- snprintf(cmd_buffer, sizeof(cmd_buffer), "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"%s\"},\"id\":1}\n",
- usr_login.c_str(), usr_pass.c_str(), get_version_str().c_str());
+ snprintf(cmd_buffer, sizeof(cmd_buffer), "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"rigid\":\"%s\",\"agent\":\"%s\"},\"id\":1}\n",
+ usr_login.c_str(), usr_pass.c_str(), usr_rigid.c_str(), get_version_str().c_str());
opq_json_val oResult(nullptr);
diff --git a/xmrstak/net/jpsock.hpp b/xmrstak/net/jpsock.hpp
index 9d276b7..d9e5542 100644
--- a/xmrstak/net/jpsock.hpp
+++ b/xmrstak/net/jpsock.hpp
@@ -27,7 +27,7 @@ class base_socket;
class jpsock
{
public:
- jpsock(size_t id, const char* sAddr, const char* sLogin, const char* sPassword, double pool_weight, bool dev_pool, bool tls, const char* tls_fp, bool nicehash);
+ jpsock(size_t id, const char* sAddr, const char* sLogin, const char* sRigId, const char* sPassword, double pool_weight, bool dev_pool, bool tls, const char* tls_fp, bool nicehash);
~jpsock();
bool connect(std::string& sConnectError);
@@ -82,6 +82,7 @@ public:
private:
std::string net_addr;
std::string usr_login;
+ std::string usr_rigid;
std::string usr_pass;
std::string tls_fp;
diff --git a/xmrstak/params.hpp b/xmrstak/params.hpp
index d0d6685..bed3427 100644
--- a/xmrstak/params.hpp
+++ b/xmrstak/params.hpp
@@ -28,6 +28,8 @@ struct params
std::string poolURL;
bool userSetPwd = false;
std::string poolPasswd;
+ bool userSetRigid = false;
+ std::string poolRigid;
std::string poolUsername;
bool nicehashMode = false;
OpenPOWER on IntegriCloud