Make the --url option mandatory
This commit is contained in:
parent
464dd1d483
commit
3f9d8727dc
2 changed files with 18 additions and 18 deletions
25
cpu-miner.c
25
cpu-miner.c
|
@ -39,7 +39,6 @@
|
||||||
#include "miner.h"
|
#include "miner.h"
|
||||||
|
|
||||||
#define PROGRAM_NAME "minerd"
|
#define PROGRAM_NAME "minerd"
|
||||||
#define DEF_RPC_URL "http://127.0.0.1:9332/"
|
|
||||||
#define LP_SCANTIME 60
|
#define LP_SCANTIME 60
|
||||||
|
|
||||||
#ifdef __linux /* Linux specific policy and affinity management */
|
#ifdef __linux /* Linux specific policy and affinity management */
|
||||||
|
@ -168,7 +167,7 @@ Options:\n\
|
||||||
-a, --algo=ALGO specify the algorithm to use\n\
|
-a, --algo=ALGO specify the algorithm to use\n\
|
||||||
scrypt scrypt(1024, 1, 1) (default)\n\
|
scrypt scrypt(1024, 1, 1) (default)\n\
|
||||||
sha256d SHA-256d\n\
|
sha256d SHA-256d\n\
|
||||||
-o, --url=URL URL of mining server (default: " DEF_RPC_URL ")\n\
|
-o, --url=URL URL of mining server\n\
|
||||||
-O, --userpass=U:P username:password pair for mining server\n\
|
-O, --userpass=U:P username:password pair for mining server\n\
|
||||||
-u, --user=USERNAME username for mining server\n\
|
-u, --user=USERNAME username for mining server\n\
|
||||||
-p, --pass=PASSWORD password for mining server\n\
|
-p, --pass=PASSWORD password for mining server\n\
|
||||||
|
@ -1267,20 +1266,31 @@ int main(int argc, char *argv[])
|
||||||
long flags;
|
long flags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rpc_url = strdup(DEF_RPC_URL);
|
|
||||||
rpc_user = strdup("");
|
rpc_user = strdup("");
|
||||||
rpc_pass = strdup("");
|
rpc_pass = strdup("");
|
||||||
|
|
||||||
/* parse command line */
|
/* parse command line */
|
||||||
parse_cmdline(argc, argv);
|
parse_cmdline(argc, argv);
|
||||||
|
|
||||||
|
if (!opt_benchmark && !rpc_url) {
|
||||||
|
fprintf(stderr, "%s: no URL supplied\n", argv[0]);
|
||||||
|
show_usage_and_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rpc_userpass) {
|
||||||
|
rpc_userpass = malloc(strlen(rpc_user) + strlen(rpc_pass) + 2);
|
||||||
|
if (!rpc_userpass)
|
||||||
|
return 1;
|
||||||
|
sprintf(rpc_userpass, "%s:%s", rpc_user, rpc_pass);
|
||||||
|
}
|
||||||
|
|
||||||
pthread_mutex_init(&applog_lock, NULL);
|
pthread_mutex_init(&applog_lock, NULL);
|
||||||
pthread_mutex_init(&stats_lock, NULL);
|
pthread_mutex_init(&stats_lock, NULL);
|
||||||
pthread_mutex_init(&g_work_lock, NULL);
|
pthread_mutex_init(&g_work_lock, NULL);
|
||||||
pthread_mutex_init(&stratum.sock_lock, NULL);
|
pthread_mutex_init(&stratum.sock_lock, NULL);
|
||||||
pthread_mutex_init(&stratum.work_lock, NULL);
|
pthread_mutex_init(&stratum.work_lock, NULL);
|
||||||
|
|
||||||
flags = strncmp(rpc_url, "https:", 6)
|
flags = !opt_benchmark && strncmp(rpc_url, "https:", 6)
|
||||||
? (CURL_GLOBAL_ALL & ~CURL_GLOBAL_SSL)
|
? (CURL_GLOBAL_ALL & ~CURL_GLOBAL_SSL)
|
||||||
: CURL_GLOBAL_ALL;
|
: CURL_GLOBAL_ALL;
|
||||||
if (curl_global_init(flags)) {
|
if (curl_global_init(flags)) {
|
||||||
|
@ -1323,13 +1333,6 @@ int main(int argc, char *argv[])
|
||||||
if (!opt_n_threads)
|
if (!opt_n_threads)
|
||||||
opt_n_threads = num_processors;
|
opt_n_threads = num_processors;
|
||||||
|
|
||||||
if (!rpc_userpass) {
|
|
||||||
rpc_userpass = malloc(strlen(rpc_user) + strlen(rpc_pass) + 2);
|
|
||||||
if (!rpc_userpass)
|
|
||||||
return 1;
|
|
||||||
sprintf(rpc_userpass, "%s:%s", rpc_user, rpc_pass);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
if (use_syslog)
|
if (use_syslog)
|
||||||
openlog("cpuminer", LOG_PID, LOG_USER);
|
openlog("cpuminer", LOG_PID, LOG_USER);
|
||||||
|
|
11
minerd.1
11
minerd.1
|
@ -1,4 +1,4 @@
|
||||||
.TH MINERD 1 "November 2013" "cpuminer 2.3.2"
|
.TH MINERD 1 "January 2014" "cpuminer 2.3.2"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
minerd \- CPU miner for Bitcoin and Litecoin
|
minerd \- CPU miner for Bitcoin and Litecoin
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -81,7 +81,7 @@ Run in offline benchmark mode.
|
||||||
Run in the background as a daemon.
|
Run in the background as a daemon.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-cert\fR=\fIFILE\fR
|
\fB\-\-cert\fR=\fIFILE\fR
|
||||||
Set a SSL certificate to use with the mining server.
|
Set an SSL certificate to use with the mining server.
|
||||||
Only supported when using the HTTPS protocol.
|
Only supported when using the HTTPS protocol.
|
||||||
.TP
|
.TP
|
||||||
\fB\-c\fR, \fB\-\-config\fR=\fIFILE\fR
|
\fB\-c\fR, \fB\-\-config\fR=\fIFILE\fR
|
||||||
|
@ -115,12 +115,9 @@ Do not switch to Stratum, even if the server advertises support for it.
|
||||||
\fB\-o\fR, \fB\-\-url\fR=[\fISCHEME\fR://][\fIUSERNAME\fR[:\fIPASSWORD\fR]@]\fIHOST\fR:\fIPORT\fR[/\fIPATH\fR]
|
\fB\-o\fR, \fB\-\-url\fR=[\fISCHEME\fR://][\fIUSERNAME\fR[:\fIPASSWORD\fR]@]\fIHOST\fR:\fIPORT\fR[/\fIPATH\fR]
|
||||||
Set the URL of the mining server to connect to.
|
Set the URL of the mining server to connect to.
|
||||||
Supported schemes are \fBhttp\fR, \fBhttps\fR and \fBstratum+tcp\fR.
|
Supported schemes are \fBhttp\fR, \fBhttps\fR and \fBstratum+tcp\fR.
|
||||||
If no scheme is specified, http is used.
|
If no scheme is specified, http is assumed.
|
||||||
Specifying a \fIPATH\fR is only supported for HTTP and HTTPS.
|
Specifying a \fIPATH\fR is only supported for HTTP and HTTPS.
|
||||||
Specifying credentials has the same effect as using the \fB\-O\fR option.
|
Specifying credentials has the same effect as using the \fB\-O\fR option.
|
||||||
If no mining server is provided,
|
|
||||||
the miner will try to connect to http://127.0.0.1:9332/,
|
|
||||||
corresponding to the default settings for a local Litecoin daemon.
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-O\fR, \fB\-\-userpass\fR=\fIUSERNAME\fR:\fIPASSWORD\fR
|
\fB\-O\fR, \fB\-\-userpass\fR=\fIUSERNAME\fR:\fIPASSWORD\fR
|
||||||
Set the credentials to use for connecting to the mining server.
|
Set the credentials to use for connecting to the mining server.
|
||||||
|
@ -166,7 +163,7 @@ Any username previously set with \fB\-O\fR is discarded.
|
||||||
\fB\-V\fR, \fB\-\-version\fR
|
\fB\-V\fR, \fB\-\-version\fR
|
||||||
Display version information and quit.
|
Display version information and quit.
|
||||||
.TP
|
.TP
|
||||||
\fB\-x\fR, \fB\-\-proxy\fR=[\fISCHEME\fR://]\fIHOST\fR:\fIPORT\fR
|
\fB\-x\fR, \fB\-\-proxy\fR=[\fISCHEME\fR://][\fIUSERNAME\fR:\fIPASSWORD\fR@]\fIHOST\fR:\fIPORT\fR
|
||||||
Connect to the mining server through a proxy.
|
Connect to the mining server through a proxy.
|
||||||
Supported schemes are: \fBhttp\fR, \fBsocks4\fR, \fBsocks5\fR.
|
Supported schemes are: \fBhttp\fR, \fBsocks4\fR, \fBsocks5\fR.
|
||||||
Since libcurl 7.18.0, the following are also supported:
|
Since libcurl 7.18.0, the following are also supported:
|
||||||
|
|
Loading…
Add table
Reference in a new issue