This commit is contained in:
Jay D Dee
2022-01-30 20:59:54 -05:00
parent 8727d79182
commit 90137b391e
18 changed files with 159 additions and 81 deletions

View File

@@ -65,6 +65,19 @@ If not what makes it happen or not happen?
Change Log Change Log
---------- ----------
v3.19.5
Enhanced stratum-keepalive preemptively resets the stratum connection
before the server to avoid lost shares.
Added build-msys2.sh scrypt for easier compiling on Windows, see Wiki for details.
X16RT: eliminate unnecessary recalculations of the hash order.
Fix a few compiler warnings.
Fixed log colour error when a block is solved.
v3.19.4 v3.19.4
#359: Fix verthash memory allocation for non-hugepages, broken in v3.19.3. #359: Fix verthash memory allocation for non-hugepages, broken in v3.19.3.

View File

@@ -344,7 +344,7 @@ static size_t
detect_cpu(void) { detect_cpu(void) {
//union { uint8_t s[12]; uint32_t i[3]; } vendor_string; //union { uint8_t s[12]; uint32_t i[3]; } vendor_string;
//cpu_vendors_x86 vendor = cpu_nobody; //cpu_vendors_x86 vendor = cpu_nobody;
x86_regs regs; x86_regs regs; regs.eax = regs.ebx = regs.ecx = 0;
uint32_t max_level, max_ext_level; uint32_t max_level, max_ext_level;
size_t cpu_flags = 0; size_t cpu_flags = 0;
#if defined(X86ASM_AVX) || defined(X86_64ASM_AVX) #if defined(X86ASM_AVX) || defined(X86_64ASM_AVX)
@@ -460,4 +460,4 @@ get_top_cpuflag_desc(size_t flag) {
#endif #endif
#endif #endif
#endif /* defined(CPU_X86) || defined(CPU_X86_64) */ #endif /* defined(CPU_X86) || defined(CPU_X86_64) */

View File

@@ -4,11 +4,12 @@ typedef void (FASTCALL *scrypt_ROMixfn)(scrypt_mix_word_t *X/*[chunkWords]*/, sc
#endif #endif
/* romix pre/post nop function */ /* romix pre/post nop function */
/*
static void asm_calling_convention static void asm_calling_convention
scrypt_romix_nop(scrypt_mix_word_t *blocks, size_t nblocks) { scrypt_romix_nop(scrypt_mix_word_t *blocks, size_t nblocks) {
(void)blocks; (void)nblocks; (void)blocks; (void)nblocks;
} }
*/
/* romix pre/post endian conversion function */ /* romix pre/post endian conversion function */
static void asm_calling_convention static void asm_calling_convention
scrypt_romix_convert_endian(scrypt_mix_word_t *blocks, size_t nblocks) { scrypt_romix_convert_endian(scrypt_mix_word_t *blocks, size_t nblocks) {

View File

@@ -70,7 +70,10 @@ void decred_be_build_stratum_request( char *req, struct work *work,
rpc_user, work->job_id, xnonce2str, ntimestr, noncestr ); rpc_user, work->job_id, xnonce2str, ntimestr, noncestr );
free(xnonce2str); free(xnonce2str);
} }
#if !defined(min)
#define min(a,b) (a>b ? (b) :(a)) #define min(a,b) (a>b ? (b) :(a))
#endif
void decred_build_extraheader( struct work* g_work, struct stratum_ctx* sctx ) void decred_build_extraheader( struct work* g_work, struct stratum_ctx* sctx )
{ {

View File

@@ -45,6 +45,6 @@ void sha512Compute32b_parallel(
uint64_t *data[SHA512_PARALLEL_N], uint64_t *data[SHA512_PARALLEL_N],
uint64_t *digest[SHA512_PARALLEL_N]); uint64_t *digest[SHA512_PARALLEL_N]);
void sha512ProcessBlock(Sha512Context *context); void sha512ProcessBlock(Sha512Context contexti[2] );
#endif #endif

View File

@@ -35,6 +35,7 @@
#include "sph_ripemd.h" #include "sph_ripemd.h"
#if 0
/* /*
* Round functions for RIPEMD (original). * Round functions for RIPEMD (original).
*/ */
@@ -46,6 +47,7 @@ static const sph_u32 oIV[5] = {
SPH_C32(0x67452301), SPH_C32(0xEFCDAB89), SPH_C32(0x67452301), SPH_C32(0xEFCDAB89),
SPH_C32(0x98BADCFE), SPH_C32(0x10325476) SPH_C32(0x98BADCFE), SPH_C32(0x10325476)
}; };
#endif
/* /*
* Round functions for RIPEMD-128 and RIPEMD-160. * Round functions for RIPEMD-128 and RIPEMD-160.
@@ -63,6 +65,8 @@ static const sph_u32 IV[5] = {
#define ROTL SPH_ROTL32 #define ROTL SPH_ROTL32
#if 0
/* ===================================================================== */ /* ===================================================================== */
/* /*
* RIPEMD (original hash, deprecated). * RIPEMD (original hash, deprecated).
@@ -539,6 +543,8 @@ sph_ripemd128_comp(const sph_u32 msg[16], sph_u32 val[4])
#undef RIPEMD128_IN #undef RIPEMD128_IN
} }
#endif
/* ===================================================================== */ /* ===================================================================== */
/* /*
* RIPEMD-160. * RIPEMD-160.

View File

@@ -84,6 +84,7 @@
* can be cloned by copying the context (e.g. with a simple * can be cloned by copying the context (e.g. with a simple
* <code>memcpy()</code>). * <code>memcpy()</code>).
*/ */
#if 0
typedef struct { typedef struct {
#ifndef DOXYGEN_IGNORE #ifndef DOXYGEN_IGNORE
unsigned char buf[64]; /* first field, for alignment */ unsigned char buf[64]; /* first field, for alignment */
@@ -204,6 +205,8 @@ void sph_ripemd128_close(void *cc, void *dst);
*/ */
void sph_ripemd128_comp(const sph_u32 msg[16], sph_u32 val[4]); void sph_ripemd128_comp(const sph_u32 msg[16], sph_u32 val[4]);
#endif
/* ===================================================================== */ /* ===================================================================== */
/** /**

View File

@@ -74,7 +74,7 @@ typedef struct {
void sm3_init(sm3_ctx_t *ctx); void sm3_init(sm3_ctx_t *ctx);
void sm3_update(sm3_ctx_t *ctx, const unsigned char* data, size_t data_len); void sm3_update(sm3_ctx_t *ctx, const unsigned char* data, size_t data_len);
void sm3_final(sm3_ctx_t *ctx, unsigned char digest[SM3_DIGEST_LENGTH]); void sm3_final(sm3_ctx_t *ctx, unsigned char *digest);
void sm3_compress(uint32_t digest[8], const unsigned char block[SM3_BLOCK_SIZE]); void sm3_compress(uint32_t digest[8], const unsigned char block[SM3_BLOCK_SIZE]);
void sm3(const unsigned char *data, size_t datalen, void sm3(const unsigned char *data, size_t datalen,
unsigned char digest[SM3_DIGEST_LENGTH]); unsigned char digest[SM3_DIGEST_LENGTH]);

View File

@@ -24,15 +24,15 @@ int scanhash_x16rt_8way( struct work *work, uint32_t max_nonce,
if ( bench ) ptarget[7] = 0x0cff; if ( bench ) ptarget[7] = 0x0cff;
static __thread uint32_t s_ntime = UINT32_MAX; static __thread uint32_t s_ntime = UINT32_MAX;
uint32_t ntime = bswap_32( pdata[17] ); uint32_t masked_ntime = bswap_32( pdata[17] ) & 0xffffff80;
if ( s_ntime != ntime ) if ( s_ntime != masked_ntime )
{ {
x16rt_getTimeHash( ntime, &timeHash ); x16rt_getTimeHash( masked_ntime, &timeHash );
x16rt_getAlgoString( &timeHash[0], x16r_hash_order ); x16rt_getAlgoString( &timeHash[0], x16r_hash_order );
s_ntime = ntime; s_ntime = masked_ntime;
if ( opt_debug && !thr_id ) if ( opt_debug && !thr_id )
applog( LOG_INFO, "hash order: %s time: (%08x) time hash: (%08x)", applog( LOG_INFO, "hash order: %s time: (%08x) time hash: (%08x)",
x16r_hash_order, ntime, timeHash ); x16r_hash_order, bswap_32( pdata[17] ), timeHash );
} }
x16r_8way_prehash( vdata, pdata ); x16r_8way_prehash( vdata, pdata );
@@ -78,15 +78,15 @@ int scanhash_x16rt_4way( struct work *work, uint32_t max_nonce,
if ( bench ) ptarget[7] = 0x0cff; if ( bench ) ptarget[7] = 0x0cff;
static __thread uint32_t s_ntime = UINT32_MAX; static __thread uint32_t s_ntime = UINT32_MAX;
uint32_t ntime = bswap_32( pdata[17] ); uint32_t masked_ntime = bswap_32( pdata[17] ) & 0xffffff80;
if ( s_ntime != ntime ) if ( s_ntime != masked_ntime )
{ {
x16rt_getTimeHash( ntime, &timeHash ); x16rt_getTimeHash( masked_ntime, &timeHash );
x16rt_getAlgoString( &timeHash[0], x16r_hash_order ); x16rt_getAlgoString( &timeHash[0], x16r_hash_order );
s_ntime = ntime; s_ntime = masked_ntime;
if ( opt_debug && !thr_id ) if ( opt_debug && !thr_id )
applog( LOG_INFO, "hash order: %s time: (%08x) time hash: (%08x)", applog( LOG_INFO, "hash order: %s time: (%08x) time hash: (%08x)",
x16r_hash_order, ntime, timeHash ); x16r_hash_order, bswap_32( pdata[17] ), timeHash );
} }
x16r_4way_prehash( vdata, pdata ); x16r_4way_prehash( vdata, pdata );

View File

@@ -20,15 +20,15 @@ int scanhash_x16rt( struct work *work, uint32_t max_nonce,
mm128_bswap32_80( edata, pdata ); mm128_bswap32_80( edata, pdata );
static __thread uint32_t s_ntime = UINT32_MAX; static __thread uint32_t s_ntime = UINT32_MAX;
uint32_t ntime = swab32( pdata[17] ); uint32_t masked_ntime = swab32( pdata[17] ) & 0xffffff80;
if ( s_ntime != ntime ) if ( s_ntime != masked_ntime )
{ {
x16rt_getTimeHash( ntime, &timeHash ); x16rt_getTimeHash( masked_ntime, &timeHash );
x16rt_getAlgoString( &timeHash[0], x16r_hash_order ); x16rt_getAlgoString( &timeHash[0], x16r_hash_order );
s_ntime = ntime; s_ntime = masked_ntime;
if ( opt_debug && !thr_id ) if ( opt_debug && !thr_id )
applog( LOG_INFO, "hash order: %s time: (%08x) time hash: (%08x)", applog( LOG_INFO, "hash order: %s time: (%08x) time hash: (%08x)",
x16r_hash_order, ntime, timeHash ); x16r_hash_order, swab32( pdata[17] ), timeHash );
} }
x16r_prehash( edata, pdata ); x16r_prehash( edata, pdata );

10
build-msys2.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# Compile on Windows using MSYS2 and MinGW.
make distclean || echo clean
rm -f config.status
./autogen.sh || echo done
CFLAGS="-O3 --param=evrp-mode=legacy -march=native -Wall -D_WIN32_WINNT=0x0601" ./configure --with-curl
make -j 4
strip -s cpuminer

20
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.19.4. # Generated by GNU Autoconf 2.69 for cpuminer-opt 3.19.5.
# #
# #
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='cpuminer-opt' PACKAGE_NAME='cpuminer-opt'
PACKAGE_TARNAME='cpuminer-opt' PACKAGE_TARNAME='cpuminer-opt'
PACKAGE_VERSION='3.19.4' PACKAGE_VERSION='3.19.5'
PACKAGE_STRING='cpuminer-opt 3.19.4' PACKAGE_STRING='cpuminer-opt 3.19.5'
PACKAGE_BUGREPORT='' PACKAGE_BUGREPORT=''
PACKAGE_URL='' PACKAGE_URL=''
@@ -1332,7 +1332,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures cpuminer-opt 3.19.4 to adapt to many kinds of systems. \`configure' configures cpuminer-opt 3.19.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1404,7 +1404,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of cpuminer-opt 3.19.4:";; short | recursive ) echo "Configuration of cpuminer-opt 3.19.5:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@@ -1509,7 +1509,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
cpuminer-opt configure 3.19.4 cpuminer-opt configure 3.19.5
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2012,7 +2012,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by cpuminer-opt $as_me 3.19.4, which was It was created by cpuminer-opt $as_me 3.19.5, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@@ -2993,7 +2993,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='cpuminer-opt' PACKAGE='cpuminer-opt'
VERSION='3.19.4' VERSION='3.19.5'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@@ -6690,7 +6690,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by cpuminer-opt $as_me 3.19.4, which was This file was extended by cpuminer-opt $as_me 3.19.5, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@@ -6756,7 +6756,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
cpuminer-opt config.status 3.19.4 cpuminer-opt config.status 3.19.5
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@@ -1,4 +1,4 @@
AC_INIT([cpuminer-opt], [3.19.4]) AC_INIT([cpuminer-opt], [3.19.5])
AC_PREREQ([2.59c]) AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM

View File

@@ -131,6 +131,8 @@ static bool opt_stratum_keepalive = false;
static struct timeval stratum_keepalive_timer; static struct timeval stratum_keepalive_timer;
// Stratum typically times out in 5 minutes or 300 seconds // Stratum typically times out in 5 minutes or 300 seconds
#define stratum_keepalive_timeout 180 // 3 minutes #define stratum_keepalive_timeout 180 // 3 minutes
static struct timeval stratum_reset_time;
// pk_buffer_size is used as a version selector by b58 code, therefore // pk_buffer_size is used as a version selector by b58 code, therefore
// it must be set correctly to work. // it must be set correctly to work.
@@ -191,7 +193,6 @@ int default_api_listen = 4048;
static struct timeval session_start; static struct timeval session_start;
static struct timeval five_min_start; static struct timeval five_min_start;
static uint64_t session_first_block = 0; static uint64_t session_first_block = 0;
static double latency_sum = 0.;
static uint64_t submit_sum = 0; static uint64_t submit_sum = 0;
static uint64_t accept_sum = 0; static uint64_t accept_sum = 0;
static uint64_t stale_sum = 0; static uint64_t stale_sum = 0;
@@ -1147,7 +1148,7 @@ void report_summary_log( bool force )
solved, solved_block_count ); solved, solved_block_count );
} }
if ( stratum_errors ) if ( stratum_errors )
applog2( LOG_INFO, "Stratum errors %7d", stratum_errors ); applog2( LOG_INFO, "Stratum resets %7d", stratum_errors );
applog2( LOG_INFO, "Hi/Lo Share Diff %.5g / %.5g", applog2( LOG_INFO, "Hi/Lo Share Diff %.5g / %.5g",
highest_share, lowest_share ); highest_share, lowest_share );
@@ -1278,7 +1279,6 @@ static int share_result( int result, struct work *work,
else reject_sum++; else reject_sum++;
} }
submit_sum++; submit_sum++;
latency_sum += latency;
pthread_mutex_unlock( &stats_lock ); pthread_mutex_unlock( &stats_lock );
@@ -1294,9 +1294,9 @@ static int share_result( int result, struct work *work,
else rcol = CL_LRD; else rcol = CL_LRD;
} }
applog( LOG_INFO, "%d %s%s %s%s %s%s %s%s" CL_WHT ", %.3f sec (%dms)", applog( LOG_INFO, "%d %s%s %s%s %s%s %s%s%s, %.3f sec (%dms)",
my_stats.share_count, acol, ares, scol, sres, rcol, rres, bcol, my_stats.share_count, acol, ares, scol, sres, rcol, rres, bcol,
bres, share_time, latency ); bres, CL_N, share_time, latency );
if ( unlikely( opt_debug || !result || solved ) ) if ( unlikely( opt_debug || !result || solved ) )
{ {
@@ -2114,7 +2114,7 @@ static void stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work )
{ {
unsigned char *xnonce2str = bebin2hex( g_work->xnonce2, unsigned char *xnonce2str = bebin2hex( g_work->xnonce2,
g_work->xnonce2_len ); g_work->xnonce2_len );
applog( LOG_INFO, "Extranonce2 %s, Block %d, Job %s", applog( LOG_INFO, "Extranonce2 0x%s, Block %d, Job %s",
xnonce2str, sctx->block_height, g_work->job_id ); xnonce2str, sctx->block_height, g_work->job_id );
free( xnonce2str ); free( xnonce2str );
} }
@@ -2733,6 +2733,18 @@ void std_build_extraheader( struct work* g_work, struct stratum_ctx* sctx )
sctx->job.final_sapling_hash ); sctx->job.final_sapling_hash );
} }
// Loop is out of order:
//
// connect/reconnect
// handle message
// get new message
//
// change to
// connect/reconnect
// get new message
// handle message
static void *stratum_thread(void *userdata ) static void *stratum_thread(void *userdata )
{ {
struct thr_info *mythr = (struct thr_info *) userdata; struct thr_info *mythr = (struct thr_info *) userdata;
@@ -2750,6 +2762,7 @@ static void *stratum_thread(void *userdata )
if ( unlikely( stratum_need_reset ) ) if ( unlikely( stratum_need_reset ) )
{ {
stratum_need_reset = false; stratum_need_reset = false;
gettimeofday( &stratum_reset_time, NULL );
stratum_down = true; stratum_down = true;
stratum_errors++; stratum_errors++;
stratum_disconnect( &stratum ); stratum_disconnect( &stratum );
@@ -2760,7 +2773,7 @@ static void *stratum_thread(void *userdata )
applog(LOG_BLUE, "Connection changed to %s", short_url); applog(LOG_BLUE, "Connection changed to %s", short_url);
} }
else else
applog(LOG_WARNING, "Stratum connection reset"); applog(LOG_BLUE, "Stratum connection reset");
// reset stats queue as well // reset stats queue as well
restart_threads(); restart_threads();
if ( s_get_ptr != s_put_ptr ) s_get_ptr = s_put_ptr = 0; if ( s_get_ptr != s_put_ptr ) s_get_ptr = s_put_ptr = 0;
@@ -2795,34 +2808,11 @@ static void *stratum_thread(void *userdata )
} }
} }
report_summary_log( ( stratum_diff != stratum.job.diff ) // report_summary_log( ( stratum_diff != stratum.job.diff )
&& ( stratum_diff != 0. ) ); // && ( stratum_diff != 0. ) );
if ( stratum.new_job ) // if ( stratum.new_job )
stratum_gen_work( &stratum, &g_work ); // stratum_gen_work( &stratum, &g_work );
// is keepalive needed?
if ( opt_stratum_keepalive )
{
struct timeval now, et;
gettimeofday( &now, NULL );
// any shares submitted since last keepalive?
if ( last_submit_time.tv_sec > stratum_keepalive_timer.tv_sec )
memcpy( &stratum_keepalive_timer, &last_submit_time,
sizeof (struct timeval) );
timeval_subtract( &et, &now, &stratum_keepalive_timer );
if ( et.tv_sec > stratum_keepalive_timeout )
{
double diff = stratum.job.diff * 0.5;
stratum_keepalive_timer = now;
if ( !opt_quiet )
applog( LOG_BLUE,
"Stratum keepalive requesting lower difficulty" );
stratum_suggest_difficulty( &stratum, diff );
}
}
// Wait for new message from server // Wait for new message from server
if ( likely( stratum_socket_full( &stratum, opt_timeout ) ) ) if ( likely( stratum_socket_full( &stratum, opt_timeout ) ) )
@@ -2846,6 +2836,54 @@ static void *stratum_thread(void *userdata )
stratum_need_reset = true; stratum_need_reset = true;
// stratum_disconnect( &stratum ); // stratum_disconnect( &stratum );
} }
report_summary_log( ( stratum_diff != stratum.job.diff )
&& ( stratum_diff != 0. ) );
if ( !stratum_need_reset )
{
// Is keepalive needed? Mutex would normally be required but that
// would block any attempt to submit a share. A share is more
// important even if it messes up the keepalive.
if ( opt_stratum_keepalive )
{
struct timeval now, et;
gettimeofday( &now, NULL );
// any shares submitted since last keepalive?
if ( last_submit_time.tv_sec > stratum_keepalive_timer.tv_sec )
memcpy( &stratum_keepalive_timer, &last_submit_time,
sizeof (struct timeval) );
timeval_subtract( &et, &now, &stratum_keepalive_timer );
if ( et.tv_sec > stratum_keepalive_timeout )
{
double diff = stratum.job.diff * 0.5;
stratum_keepalive_timer = now;
if ( !opt_quiet )
applog( LOG_BLUE,
"Stratum keepalive requesting lower difficulty" );
stratum_suggest_difficulty( &stratum, diff );
}
if ( last_submit_time.tv_sec > stratum_reset_time.tv_sec )
timeval_subtract( &et, &now, &last_submit_time );
else
timeval_subtract( &et, &now, &stratum_reset_time );
if ( et.tv_sec > stratum_keepalive_timeout + 60 )
{
applog( LOG_NOTICE, "No shares submitted, resetting stratum connection" );
stratum_need_reset = true;
stratum_keepalive_timer = now;
}
} // stratum_keepalive
if ( stratum.new_job && !stratum_need_reset )
stratum_gen_work( &stratum, &g_work );
} // stratum_need_reset
} // loop } // loop
out: out:
return NULL; return NULL;
@@ -3434,7 +3472,8 @@ void parse_arg(int key, char *arg )
break; break;
case 1021: // cpu-priority case 1021: // cpu-priority
v = atoi(arg); v = atoi(arg);
if (v < 0 || v > 5) /* sanity check */ applog(LOG_NOTICE,"--cpu-priority is deprecated and will be removed from a future release");
if (v < 0 || v > 5) /* sanity check */
show_usage_and_exit(1); show_usage_and_exit(1);
opt_priority = v; opt_priority = v;
break; break;
@@ -3470,7 +3509,8 @@ void parse_arg(int key, char *arg )
break; break;
case 1024: case 1024:
opt_randomize = true; opt_randomize = true;
break; applog(LOG_NOTICE,"--randomize is deprecated and will be removed from a future release");
break;
case 1027: // data-file case 1027: // data-file
opt_data_file = strdup( arg ); opt_data_file = strdup( arg );
break; break;
@@ -3930,6 +3970,7 @@ int main(int argc, char *argv[])
memcpy( &five_min_start, &last_submit_time, sizeof (struct timeval) ); memcpy( &five_min_start, &last_submit_time, sizeof (struct timeval) );
memcpy( &session_start, &last_submit_time, sizeof (struct timeval) ); memcpy( &session_start, &last_submit_time, sizeof (struct timeval) );
memcpy( &stratum_keepalive_timer, &last_submit_time, sizeof (struct timeval) ); memcpy( &stratum_keepalive_timer, &last_submit_time, sizeof (struct timeval) );
memcpy( &stratum_reset_time, &last_submit_time, sizeof (struct timeval) );
memcpy( &total_hashes_time, &last_submit_time, sizeof (struct timeval) ); memcpy( &total_hashes_time, &last_submit_time, sizeof (struct timeval) );
pthread_mutex_unlock( &stats_lock ); pthread_mutex_unlock( &stats_lock );

19
miner.h
View File

@@ -824,6 +824,7 @@ Options:\n\
qubit Qubit\n\ qubit Qubit\n\
scrypt scrypt(1024, 1, 1) (default)\n\ scrypt scrypt(1024, 1, 1) (default)\n\
scrypt:N scrypt(N, 1, 1)\n\ scrypt:N scrypt(N, 1, 1)\n\
scryptn2 scrypt(1048576, 1,1)\n\
sha256d Double SHA-256\n\ sha256d Double SHA-256\n\
sha256q Quad SHA-256, Pyrite (PYE)\n\ sha256q Quad SHA-256, Pyrite (PYE)\n\
sha256t Triple SHA-256, Onecoin (OC)\n\ sha256t Triple SHA-256, Onecoin (OC)\n\
@@ -886,10 +887,10 @@ Options:\n\
-T, --timeout=N timeout for long poll and stratum (default: 300 seconds)\n\ -T, --timeout=N timeout for long poll and stratum (default: 300 seconds)\n\
-s, --scantime=N upper bound on time spent scanning current work when\n\ -s, --scantime=N upper bound on time spent scanning current work when\n\
long polling is unavailable, in seconds (default: 5)\n\ long polling is unavailable, in seconds (default: 5)\n\
--randomize Randomize scan range start to reduce duplicates\n\ --randomize randomize scan range (deprecated)\n\
-f, --diff-factor=N Divide req. difficulty by this factor (std is 1.0)\n\ -f, --diff-factor=N divide req. difficulty by this factor (std is 1.0)\n\
-m, --diff-multiplier=N Multiply difficulty by this factor (std is 1.0)\n\ -m, --diff-multiplier=N Multiply difficulty by this factor (std is 1.0)\n\
--hash-meter Display thread hash rates\n\ --hash-meter display thread hash rates\n\
--coinbase-addr=ADDR payout address for solo mining\n\ --coinbase-addr=ADDR payout address for solo mining\n\
--coinbase-sig=TEXT data to insert in the coinbase when possible\n\ --coinbase-sig=TEXT data to insert in the coinbase when possible\n\
--no-longpoll disable long polling support\n\ --no-longpoll disable long polling support\n\
@@ -910,16 +911,16 @@ Options:\n\
-B, --background run the miner in the background\n\ -B, --background run the miner in the background\n\
--benchmark run in offline benchmark mode\n\ --benchmark run in offline benchmark mode\n\
--cpu-affinity set process affinity to cpu core(s), mask 0x3 for cores 0 and 1\n\ --cpu-affinity set process affinity to cpu core(s), mask 0x3 for cores 0 and 1\n\
--cpu-priority set process priority (default: 0 idle, 2 normal to 5 highest)\n\ --cpu-priority set process priority (default: 0 idle, 2 normal to 5 highest) (deprecated)\n\
-b, --api-bind=address[:port] IP address for the miner API, default port is 4048)\n\ -b, --api-bind=address[:port] IP address for the miner API, default port is 4048)\n\
--api-remote Allow remote control\n\ --api-remote allow remote control\n\
--max-temp=N Only mine if cpu temp is less than specified value (linux)\n\ --max-temp=N only mine if cpu temp is less than specified value (linux)\n\
--max-rate=N[KMG] Only mine if net hashrate is less than specified value\n\ --max-rate=N[KMG] only mine if net hashrate is less than specified value\n\
--max-diff=N Only mine if net difficulty is less than specified value\n\ --max-diff=N only mine if net difficulty is less than specified value\n\
-c, --config=FILE load a JSON-format configuration file\n\ -c, --config=FILE load a JSON-format configuration file\n\
--data-file=FILE path and name of data file\n\ --data-file=FILE path and name of data file\n\
--verify enable additional time consuming start up tests\n\ --verify enable additional time consuming start up tests\n\
--stratum-keepalive Prevent disconnects when difficulty is too high\n\ --stratum-keepalive prevent disconnects when difficulty is too high\n\
-V, --version display version and CPU information and exit\n\ -V, --version display version and CPU information and exit\n\
-h, --help display this help text and exit\n\ -h, --help display this help text and exit\n\
"; ";

View File

@@ -209,7 +209,7 @@ static inline void cpu_getname(char *outbuf, size_t maxsz)
{ {
memset(outbuf, 0, maxsz); memset(outbuf, 0, maxsz);
#ifdef WIN32 #ifdef WIN32
char brand[0xC0] = { 0 }; char brand[256] = { 0 };
int output[4] = { 0 }, ext; int output[4] = { 0 }, ext;
cpuid(0x80000000, output); cpuid(0x80000000, output);
ext = output[0]; ext = output[0];

2
util.c
View File

@@ -1658,7 +1658,7 @@ static bool stratum_parse_extranonce(struct stratum_ctx *sctx, json_t *params, i
pthread_mutex_unlock(&sctx->work_lock); pthread_mutex_unlock(&sctx->work_lock);
if ( !opt_quiet ) /* pool dynamic change */ if ( !opt_quiet ) /* pool dynamic change */
applog( LOG_INFO, "Stratum extranonce1= %s, extranonce2 size= %d", applog( LOG_INFO, "Stratum extranonce1 0x%s, extranonce2 size %d",
xnonce1, xn2_size); xnonce1, xn2_size);
return true; return true;

View File

@@ -16,8 +16,8 @@ export MINGW_LIB="/usr/x86_64-w64-mingw32/lib"
export GCC_MINGW_LIB="/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32" export GCC_MINGW_LIB="/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32"
# used by GCC # used by GCC
export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs -L$LOCAL_LIB/openssl" export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs -L$LOCAL_LIB/openssl"
# support for Windows CPU groups, AES sometimes not included in -march # Support for Windows 7 CPU groups, AES sometimes not included in -march
export DEFAULT_CFLAGS="-O3 -maes -Wall -D_WIN32_WINNT=0x0601" export DEFAULT_CFLAGS="-maes -O3 -Wall -D_WIN32_WINNT=0x0601"
export DEFAULT_CFLAGS_OLD="-O3 -Wall" export DEFAULT_CFLAGS_OLD="-O3 -Wall"
# make link to local gmp header file. # make link to local gmp header file.
@@ -26,8 +26,8 @@ ln -s $LOCAL_LIB/gmp/gmp.h ./gmp.h
# make release directory and copy selected DLLs. # make release directory and copy selected DLLs.
rm -rf release > /dev/null rm -rf release > /dev/null
mkdir release mkdir release
cp README.txt release/ cp README.txt release/
cp README.md release/ cp README.md release/
cp RELEASE_NOTES release/ cp RELEASE_NOTES release/