|
|
@@ -100,6 +100,10 @@ bool opt_protocol;
|
|
|
static bool opt_benchmark;
|
|
|
static bool want_longpoll = true;
|
|
|
static bool want_gbt = true;
|
|
|
+#if BLKMAKER_VERSION < 1
|
|
|
+const
|
|
|
+#endif
|
|
|
+char *opt_coinbase_sig;
|
|
|
bool have_longpoll;
|
|
|
bool want_per_device_stats;
|
|
|
bool use_syslog;
|
|
|
@@ -933,6 +937,16 @@ static struct opt_table opt_config_table[] = {
|
|
|
OPT_WITH_ARG("--bench-algo|-b",
|
|
|
set_int_0_to_9999, opt_show_intval, &opt_bench_algo,
|
|
|
opt_hidden),
|
|
|
+#endif
|
|
|
+#if BLKMAKER_VERSION > 0
|
|
|
+ OPT_WITH_ARG("--coinbase-sig",
|
|
|
+ opt_set_charp, NULL, &opt_coinbase_sig,
|
|
|
+ "Set coinbase signature when possible"),
|
|
|
+ OPT_WITH_ARG("--coinbase|--cbsig|--cb-sig|--cb|--prayer",
|
|
|
+ opt_set_charp, NULL, &opt_coinbase_sig,
|
|
|
+ opt_hidden),
|
|
|
+#endif
|
|
|
+#ifdef WANT_CPUMINE
|
|
|
OPT_WITH_ARG("--cpu-threads|-t",
|
|
|
force_nthreads_int, opt_show_intval, &opt_n_threads,
|
|
|
"Number of miner CPU threads"),
|
|
|
@@ -1472,6 +1486,36 @@ static bool work_decode(const json_t *val, struct work *work)
|
|
|
goto err_out;
|
|
|
}
|
|
|
work->rolltime = blkmk_time_left(work->tmpl, time(NULL));
|
|
|
+#if BLKMAKER_VERSION > 0
|
|
|
+ if (opt_coinbase_sig) {
|
|
|
+ ssize_t ae = blkmk_append_coinbase_safe(work->tmpl, opt_coinbase_sig, 101);
|
|
|
+ static bool appenderr = false;
|
|
|
+ if (ae <= 0) {
|
|
|
+ applog((appenderr ? LOG_DEBUG : LOG_WARNING), "Cannot append coinbase signature at all on pool %u (%d)", ae, work->pool->pool_no);
|
|
|
+ appenderr = true;
|
|
|
+ } else {
|
|
|
+ size_t cbappendsz = strlen(opt_coinbase_sig);
|
|
|
+ static bool truncatewarning = false;
|
|
|
+ if (cbappendsz <= (size_t)ae) {
|
|
|
+ ae = cbappendsz;
|
|
|
+ truncatewarning = false;
|
|
|
+ } else {
|
|
|
+ char *tmp = strndup(opt_coinbase_sig, ae);
|
|
|
+ applog((truncatewarning ? LOG_DEBUG : LOG_WARNING),
|
|
|
+ "Pool %u truncating appended coinbase signature at %d bytes: %s(%s)",
|
|
|
+ work->pool->pool_no, ae, tmp, &opt_coinbase_sig[ae]);
|
|
|
+ free(tmp);
|
|
|
+ truncatewarning = true;
|
|
|
+ }
|
|
|
+ ae = blkmk_append_coinbase_safe(work->tmpl, opt_coinbase_sig, ae);
|
|
|
+ if (ae <= 0) {
|
|
|
+ applog((appenderr ? LOG_DEBUG : LOG_WARNING), "Error appending coinbase signature (%d)", ae);
|
|
|
+ appenderr = true;
|
|
|
+ } else
|
|
|
+ appenderr = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
if (blkmk_get_data(work->tmpl, work->data, 80, time(NULL), NULL, &work->dataid) < 76)
|
|
|
goto err_out;
|
|
|
swap32yes(work->data, work->data, 80 / 4);
|