v3.12.4.3

This commit is contained in:
Jay D Dee
2020-02-24 21:35:19 -05:00
parent 45c77a5c81
commit 0e1e88f53e
4 changed files with 64 additions and 38 deletions

View File

@@ -65,6 +65,12 @@ If not what makes it happen or not happen?
Change Log Change Log
---------- ----------
v3.12.4.3
Fixed segfault in new block log for getwork.
Disabled silent discarding of stale work after the submit is logged.
v3.12.4.2 v3.12.4.2
Issue #245: fixed getwork stale shares, solo mining with getwork now works. Issue #245: fixed getwork stale shares, solo mining with getwork now works.

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.12.4.2. # Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.4.3.
# #
# #
# 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.12.4.2' PACKAGE_VERSION='3.12.4.3'
PACKAGE_STRING='cpuminer-opt 3.12.4.2' PACKAGE_STRING='cpuminer-opt 3.12.4.3'
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.12.4.2 to adapt to many kinds of systems. \`configure' configures cpuminer-opt 3.12.4.3 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.12.4.2:";; short | recursive ) echo "Configuration of cpuminer-opt 3.12.4.3:";;
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.12.4.2 cpuminer-opt configure 3.12.4.3
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.12.4.2, which was It was created by cpuminer-opt $as_me 3.12.4.3, 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.12.4.2' VERSION='3.12.4.3'
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.12.4.2, which was This file was extended by cpuminer-opt $as_me 3.12.4.3, 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.12.4.2 cpuminer-opt config.status 3.12.4.3
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.12.4.2]) AC_INIT([cpuminer-opt], [3.12.4.3])
AC_PREREQ([2.59c]) AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM

View File

@@ -1062,25 +1062,39 @@ static int share_result( int result, struct work *null_work,
if ( likely( result ) ) if ( likely( result ) )
{ {
accepted_share_count++; accepted_share_count++;
sprintf( sres, "S%d", stale_share_count );
sprintf( rres, "R%d", rejected_share_count );
if unlikely( ( my_stats.net_diff > 0. ) if unlikely( ( my_stats.net_diff > 0. )
&& ( my_stats.share_diff >= net_diff ) ) && ( my_stats.share_diff >= net_diff ) )
{ {
solved = true; solved = true;
solved_block_count++; solved_block_count++;
sprintf( bres, "BLOCK SOLVED %d", solved_block_count );
sprintf( ares, "A%d", accepted_share_count );
}
else
{
sprintf( bres, "B%d", solved_block_count );
sprintf( ares, "Accepted %d", accepted_share_count );
} }
} }
else else
{ {
sprintf( ares, "A%d", accepted_share_count );
sprintf( bres, "B%d", solved_block_count );
if ( reason && strstr( reason, "Invalid job id" ) ) if ( reason && strstr( reason, "Invalid job id" ) )
{ {
stale = true; stale = true;
stale_share_count++; stale_share_count++;
sprintf( sres, "Stale %d", stale_share_count );
sprintf( rres, "R%d", rejected_share_count );
} }
else else
{ {
rejected_share_count++; rejected_share_count++;
sprintf( sres, "S%d", stale_share_count );
sprintf( rres, "Rejected %d" , rejected_share_count );
lowdiff_debug = true; lowdiff_debug = true;
} }
} }
@@ -1106,6 +1120,7 @@ static int share_result( int result, struct work *null_work,
pthread_mutex_unlock( &stats_lock ); pthread_mutex_unlock( &stats_lock );
/*
if ( likely( result ) ) if ( likely( result ) )
{ {
if ( unlikely( solved ) ) if ( unlikely( solved ) )
@@ -1136,6 +1151,7 @@ static int share_result( int result, struct work *null_work,
sprintf( rres, "Rejected %d" , rejected_share_count ); sprintf( rres, "Rejected %d" , rejected_share_count );
} }
} }
*/
if ( use_colors ) if ( use_colors )
{ {
@@ -1163,8 +1179,7 @@ static int share_result( int result, struct work *null_work,
scol, my_stats.job_id ); scol, my_stats.job_id );
else else
applog2( LOG_NOTICE, "Diff %.5g (%.3g%), %sBlock %d" CL_WHT, applog2( LOG_NOTICE, "Diff %.5g (%.3g%), %sBlock %d" CL_WHT,
my_stats.share_diff, share_ratio, bcol, stratum.block_height, my_stats.share_diff, share_ratio, bcol, stratum.block_height );
scol );
} }
if ( unlikely( reason && !result ) ) if ( unlikely( reason && !result ) )
@@ -1198,6 +1213,9 @@ static int share_result( int result, struct work *null_work,
return 1; return 1;
} }
static const char *json_submit_req =
"{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}";
void std_le_build_stratum_request( char *req, struct work *work ) void std_le_build_stratum_request( char *req, struct work *work )
{ {
unsigned char *xnonce2str; unsigned char *xnonce2str;
@@ -1208,9 +1226,8 @@ void std_le_build_stratum_request( char *req, struct work *work )
bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) ); bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) );
bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) ); bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) );
xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len ); xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len );
snprintf( req, JSON_BUF_LEN, snprintf( req, JSON_BUF_LEN, json_submit_req, rpc_user, work->job_id,
"{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", xnonce2str, ntimestr, noncestr );
rpc_user, work->job_id, xnonce2str, ntimestr, noncestr );
free( xnonce2str ); free( xnonce2str );
} }
@@ -1225,12 +1242,14 @@ void std_be_build_stratum_request( char *req, struct work *work )
bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) ); bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) );
bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) ); bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) );
xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len ); xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len );
snprintf( req, JSON_BUF_LEN, snprintf( req, JSON_BUF_LEN, json_submit_req, rpc_user, work->job_id,
"{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", xnonce2str, ntimestr, noncestr );
rpc_user, work->job_id, xnonce2str, ntimestr, noncestr );
free( xnonce2str ); free( xnonce2str );
} }
static const char *json_getwork_req =
"{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":4}\r\n";
bool std_le_submit_getwork_result( CURL *curl, struct work *work ) bool std_le_submit_getwork_result( CURL *curl, struct work *work )
{ {
char req[JSON_BUF_LEN]; char req[JSON_BUF_LEN];
@@ -1247,8 +1266,7 @@ bool std_le_submit_getwork_result( CURL *curl, struct work *work )
return false; return false;
} }
// build JSON-RPC request // build JSON-RPC request
snprintf( req, JSON_BUF_LEN, snprintf( req, JSON_BUF_LEN, json_getwork_req, gw_str );
"{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":4}\r\n", gw_str );
free( gw_str ); free( gw_str );
// issue JSON-RPC request // issue JSON-RPC request
val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 ); val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 );
@@ -1281,8 +1299,7 @@ bool std_be_submit_getwork_result( CURL *curl, struct work *work )
return false; return false;
} }
// build JSON-RPC request // build JSON-RPC request
snprintf( req, JSON_BUF_LEN, snprintf( req, JSON_BUF_LEN, json_getwork_req, gw_str );
"{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":4}\r\n", gw_str );
free( gw_str ); free( gw_str );
// issue JSON-RPC request // issue JSON-RPC request
val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 ); val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 );
@@ -1337,25 +1354,27 @@ char* std_malloc_txs_request( struct work *work )
static bool submit_upstream_work( CURL *curl, struct work *work ) static bool submit_upstream_work( CURL *curl, struct work *work )
{ {
/* pass if the previous hash is not the current previous hash */ /* pass if the previous hash is not the current previous hash */
/* Submit anyway, discardring here messes up the stats
if ( !submit_old && memcmp( &work->data[1], &g_work.data[1], 32 ) ) if ( !submit_old && memcmp( &work->data[1], &g_work.data[1], 32 ) )
{ {
if (opt_debug) applog( LOG_WARNING, "Stale work detected, discarding" );
applog(LOG_DEBUG, "DEBUG: stale work detected, discarding");
return true; return true;
} }
if ( !have_stratum && allow_mininginfo ) if ( !have_stratum && allow_mininginfo )
{ {
struct work wheight; struct work mining_info;
get_mininginfo( curl, &wheight ); get_mininginfo( curl, &mining_info );
if ( work->height && work->height <= net_blocks ) if ( work->height < mining_info.height )
{ {
if (opt_debug) applog( LOG_WARNING, "Block %u was already solved, current block %d",
applog(LOG_WARNING, "block %u was already solved", work->height); work->height, mining_info.height );
return true; return true;
} }
} }
*/
if ( have_stratum ) if ( have_stratum )
{ {
@@ -1488,7 +1507,8 @@ start:
// store work height in solo // store work height in solo
get_mininginfo(curl, work); get_mininginfo(curl, work);
applog( LOG_BLUE, "%s %s block %d, diff %.5g", work->height, net_diff ); applog( LOG_BLUE, "%s %s block %d, diff %.5g", algo_names[ opt_algo ],
short_url, work->height, net_diff );
if ( !opt_quiet && net_diff && net_hashrate ) if ( !opt_quiet && net_diff && net_hashrate )
{ {
@@ -1907,17 +1927,15 @@ void std_get_new_work( struct work* work, struct work* g_work, int thr_id,
uint32_t *end_nonce_ptr ) uint32_t *end_nonce_ptr )
{ {
uint32_t *nonceptr = work->data + algo_gate.nonce_index; uint32_t *nonceptr = work->data + algo_gate.nonce_index;
bool force_new_work; bool force_new_work = false;
if ( have_stratum ) if ( have_stratum )
force_new_work = work->job_id ? strtoul( work->job_id, NULL, 16 ) force_new_work = work->job_id ? strtoul( work->job_id, NULL, 16 )
!= strtoul( g_work->job_id, NULL, 16 ) != strtoul( g_work->job_id, NULL, 16 )
: true; : false;
else
force_new_work = memcmp( work->data, g_work->data,
algo_gate.work_cmp_size );
if ( force_new_work || *nonceptr >= *end_nonce_ptr ) if ( force_new_work || ( *nonceptr >= *end_nonce_ptr )
|| memcmp( work->data, g_work->data, algo_gate.work_cmp_size ) )
{ {
work_free( work ); work_free( work );
work_copy( work, g_work ); work_copy( work, g_work );
@@ -2287,6 +2305,8 @@ void restart_threads(void)
{ {
for ( int i = 0; i < opt_n_threads; i++) for ( int i = 0; i < opt_n_threads; i++)
work_restart[i].restart = 1; work_restart[i].restart = 1;
if ( opt_debug )
applog( LOG_INFO, "Threads restarted for new work.");
} }
json_t *std_longpoll_rpc_call( CURL *curl, int *err, char* lp_url ) json_t *std_longpoll_rpc_call( CURL *curl, int *err, char* lp_url )