This commit is contained in:
Jay D Dee
2017-10-12 15:14:37 -04:00
parent 989fb42d20
commit c76574b2cd
11 changed files with 91 additions and 18 deletions

View File

@@ -114,8 +114,8 @@ void init_algo_gate( algo_gate_t* gate )
gate->stratum_gen_work = (void*)&std_stratum_gen_work; gate->stratum_gen_work = (void*)&std_stratum_gen_work;
gate->build_stratum_request = (void*)&std_le_build_stratum_request; gate->build_stratum_request = (void*)&std_le_build_stratum_request;
gate->set_target = (void*)&std_set_target; gate->set_target = (void*)&std_set_target;
gate->work_decode = (void*)&std_work_decode; gate->work_decode = (void*)&std_le_work_decode;
gate->submit_getwork_result = (void*)&std_submit_getwork_result; gate->submit_getwork_result = (void*)&std_le_submit_getwork_result;
gate->build_extraheader = (void*)&std_build_extraheader; gate->build_extraheader = (void*)&std_build_extraheader;
gate->set_work_data_endian = (void*)&do_nothing; gate->set_work_data_endian = (void*)&do_nothing;
gate->calc_network_diff = (void*)&std_calc_network_diff; gate->calc_network_diff = (void*)&std_calc_network_diff;

View File

@@ -215,10 +215,12 @@ int64_t get_max64_0xffffLL();
void std_set_target ( struct work *work, double job_diff ); void std_set_target ( struct work *work, double job_diff );
void scrypt_set_target( struct work *work, double job_diff ); void scrypt_set_target( struct work *work, double job_diff );
bool std_work_decode( const json_t *val, struct work *work ); bool std_le_work_decode( const json_t *val, struct work *work );
bool std_be_work_decode( const json_t *val, struct work *work );
bool jr2_work_decode( const json_t *val, struct work *work ); bool jr2_work_decode( const json_t *val, struct work *work );
bool std_submit_getwork_result( CURL *curl, struct work *work ); bool std_le_submit_getwork_result( CURL *curl, struct work *work );
bool std_be_submit_getwork_result( CURL *curl, struct work *work );
bool jr2_submit_getwork_result( CURL *curl, struct work *work ); bool jr2_submit_getwork_result( CURL *curl, struct work *work );
void std_le_build_stratum_request( char *req, struct work *work ); void std_le_build_stratum_request( char *req, struct work *work );

View File

@@ -220,6 +220,8 @@ bool register_blake2b_algo( algo_gate_t* gate )
gate->hash = (void*)&blake2b_hash; gate->hash = (void*)&blake2b_hash;
gate->calc_network_diff = (void*)&blake2b_calc_network_diff; gate->calc_network_diff = (void*)&blake2b_calc_network_diff;
gate->build_stratum_request = (void*)&blake2b_be_build_stratum_request; gate->build_stratum_request = (void*)&blake2b_be_build_stratum_request;
gate->work_decode = (void*)&std_be_work_decode;
gate->submit_getwork_result = (void*)&std_be_submit_getwork_result;
gate->build_extraheader = (void*)&blake2b_build_extraheader; gate->build_extraheader = (void*)&blake2b_build_extraheader;
gate->get_new_work = (void*)&blake2b_get_new_work; gate->get_new_work = (void*)&blake2b_get_new_work;
gate->get_max64 = (void*)&blake2b_get_max64; gate->get_max64 = (void*)&blake2b_get_max64;

View File

@@ -274,6 +274,8 @@ bool register_decred_algo( algo_gate_t* gate )
gate->get_max64 = (void*)&get_max64_0x3fffffLL; gate->get_max64 = (void*)&get_max64_0x3fffffLL;
gate->display_extra_data = (void*)&decred_decode_extradata; gate->display_extra_data = (void*)&decred_decode_extradata;
gate->build_stratum_request = (void*)&decred_be_build_stratum_request; gate->build_stratum_request = (void*)&decred_be_build_stratum_request;
gate->work_decode = (void*)&std_be_work_decode;
gate->submit_getwork_result = (void*)&std_be_submit_getwork_result;
gate->build_extraheader = (void*)&decred_build_extraheader; gate->build_extraheader = (void*)&decred_build_extraheader;
gate->ready_to_mine = (void*)&decred_ready_to_mine; gate->ready_to_mine = (void*)&decred_ready_to_mine;
gate->nbits_index = DECRED_NBITS_INDEX; gate->nbits_index = DECRED_NBITS_INDEX;

View File

@@ -248,6 +248,8 @@ bool register_drop_algo( algo_gate_t* gate )
gate->get_new_work = (void*)&drop_get_new_work; gate->get_new_work = (void*)&drop_get_new_work;
gate->set_target = (void*)&scrypt_set_target; gate->set_target = (void*)&scrypt_set_target;
gate->build_stratum_request = (void*)&std_be_build_stratum_request; gate->build_stratum_request = (void*)&std_be_build_stratum_request;
gate->work_decode = (void*)&std_be_work_decode;
gate->submit_getwork_result = (void*)&std_be_submit_getwork_result;
gate->set_work_data_endian = (void*)&swab_work_data; gate->set_work_data_endian = (void*)&swab_work_data;
gate->display_extra_data = (void*)&drop_display_pok; gate->display_extra_data = (void*)&drop_display_pok;
gate->work_data_size = 80; gate->work_data_size = 80;

View File

@@ -372,10 +372,11 @@ bool register_m7m_algo( algo_gate_t *gate )
init_m7m_ctx(); init_m7m_ctx();
gate->scanhash = (void*)scanhash_m7m_hash; gate->scanhash = (void*)scanhash_m7m_hash;
gate->build_stratum_request = (void*)&std_be_build_stratum_request; gate->build_stratum_request = (void*)&std_be_build_stratum_request;
gate->work_decode = (void*)&std_be_work_decode;
gate->submit_getwork_result = (void*)&std_be_submit_getwork_result;
gate->set_target = (void*)&scrypt_set_target; gate->set_target = (void*)&scrypt_set_target;
gate->get_max64 = (void*)&get_max64_0x1ffff; gate->get_max64 = (void*)&get_max64_0x1ffff;
gate->set_work_data_endian = (void*)&m7m_reverse_endian; gate->set_work_data_endian = (void*)&m7m_reverse_endian;
gate->work_data_size = 80;
return true; return true;
} }

View File

@@ -1089,6 +1089,8 @@ bool register_neoscrypt_algo( algo_gate_t* gate )
gate->set_target = (void*)&scrypt_set_target; gate->set_target = (void*)&scrypt_set_target;
gate->wait_for_diff = (void*)&neoscrypt_wait_for_diff; gate->wait_for_diff = (void*)&neoscrypt_wait_for_diff;
gate->build_stratum_request = (void*)&std_be_build_stratum_request; gate->build_stratum_request = (void*)&std_be_build_stratum_request;
gate->work_decode = (void*)&std_be_work_decode;
gate->submit_getwork_result = (void*)&std_be_submit_getwork_result;
gate->set_work_data_endian = (void*)&swab_work_data; gate->set_work_data_endian = (void*)&swab_work_data;
gate->work_data_size = 80; gate->work_data_size = 80;
return true; return true;

View File

@@ -229,6 +229,8 @@ bool register_zr5_algo( algo_gate_t* gate )
gate->get_max64 = (void*)&zr5_get_max64; gate->get_max64 = (void*)&zr5_get_max64;
gate->display_extra_data = (void*)&zr5_display_pok; gate->display_extra_data = (void*)&zr5_display_pok;
gate->build_stratum_request = (void*)&std_be_build_stratum_request; gate->build_stratum_request = (void*)&std_be_build_stratum_request;
gate->work_decode = (void*)&std_be_work_decode;
gate->submit_getwork_result = (void*)&std_be_submit_getwork_result;
gate->set_work_data_endian = (void*)&swab_work_data; gate->set_work_data_endian = (void*)&swab_work_data;
gate->work_data_size = 80; gate->work_data_size = 80;
gate->work_cmp_size = 72; gate->work_cmp_size = 72;

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.6.10. # Generated by GNU Autoconf 2.69 for cpuminer-opt 3.6.11.
# #
# #
# 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.6.10' PACKAGE_VERSION='3.6.11'
PACKAGE_STRING='cpuminer-opt 3.6.10' PACKAGE_STRING='cpuminer-opt 3.6.11'
PACKAGE_BUGREPORT='' PACKAGE_BUGREPORT=''
PACKAGE_URL='' PACKAGE_URL=''
@@ -1321,7 +1321,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.6.10 to adapt to many kinds of systems. \`configure' configures cpuminer-opt 3.6.11 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1392,7 +1392,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.6.10:";; short | recursive ) echo "Configuration of cpuminer-opt 3.6.11:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@@ -1497,7 +1497,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.6.10 cpuminer-opt configure 3.6.11
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.
@@ -2000,7 +2000,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.6.10, which was It was created by cpuminer-opt $as_me 3.6.11, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@@ -2981,7 +2981,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='cpuminer-opt' PACKAGE='cpuminer-opt'
VERSION='3.6.10' VERSION='3.6.11'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@@ -6677,7 +6677,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.6.10, which was This file was extended by cpuminer-opt $as_me 3.6.11, 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
@@ -6743,7 +6743,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.6.10 cpuminer-opt config.status 3.6.11
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.6.10]) AC_INIT([cpuminer-opt], [3.6.11])
AC_PREREQ([2.59c]) AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM

View File

@@ -279,7 +279,7 @@ void work_copy(struct work *dest, const struct work *src)
bool jr2_work_decode( const json_t *val, struct work *work ) bool jr2_work_decode( const json_t *val, struct work *work )
{ return rpc2_job_decode( val, work ); } { return rpc2_job_decode( val, work ); }
bool std_work_decode( const json_t *val, struct work *work ) bool std_le_work_decode( const json_t *val, struct work *work )
{ {
int i; int i;
const int data_size = algo_gate.work_data_size; const int data_size = algo_gate.work_data_size;
@@ -304,6 +304,31 @@ bool std_work_decode( const json_t *val, struct work *work )
return true; return true;
} }
bool std_be_work_decode( const json_t *val, struct work *work )
{
int i;
const int data_size = algo_gate.work_data_size;
const int target_size = sizeof(work->target);
const int adata_sz = data_size / 4;
const int atarget_sz = ARRAY_SIZE(work->target);
if (unlikely( !jobj_binary(val, "data", work->data, data_size) ))
{
applog(LOG_ERR, "JSON invalid data");
return false;
}
if (unlikely( !jobj_binary(val, "target", work->target, target_size) ))
{
applog(LOG_ERR, "JSON invalid target");
return false;
}
for ( i = 0; i < adata_sz; i++ )
work->data[i] = be32dec( work->data + i );
for ( i = 0; i < atarget_sz; i++ )
work->target[i] = be32dec( work->target + i );
return true;
}
static bool work_decode( const json_t *val, struct work *work ) static bool work_decode( const json_t *val, struct work *work )
{ {
if ( !algo_gate.work_decode( val, work ) ) if ( !algo_gate.work_decode( val, work ) )
@@ -852,7 +877,7 @@ void jr2_build_stratum_request( char *req, struct work *work )
free( hashhex ); free( hashhex );
} }
bool std_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];
json_t *val, *res, *reason; json_t *val, *res, *reason;
@@ -886,6 +911,41 @@ bool std_submit_getwork_result( CURL *curl, struct work *work )
return true; return true;
} }
bool std_be_submit_getwork_result( CURL *curl, struct work *work )
{
char req[JSON_BUF_LEN];
json_t *val, *res, *reason;
char* gw_str;
int data_size = algo_gate.work_data_size;
for ( int i = 0; i < data_size / sizeof(uint32_t); i++ )
be32enc( &work->data[i], work->data[i] );
gw_str = abin2hex( (uchar*)work->data, data_size );
if ( unlikely(!gw_str) )
{
applog(LOG_ERR, "submit_upstream_work OOM");
return false;
}
// build JSON-RPC request
snprintf( req, JSON_BUF_LEN,
"{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":4}\r\n", gw_str );
free( gw_str );
// issue JSON-RPC request
val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 );
if ( unlikely(!val) )
{
applog(LOG_ERR, "submit_upstream_work json_rpc_call failed");
return false;
}
res = json_object_get( val, "result" );
reason = json_object_get( val, "reject-reason" );
share_result( json_is_true( res ), work,
reason ? json_string_value( reason ) : NULL );
json_decref( val );
return true;
}
bool jr2_submit_getwork_result( CURL *curl, struct work *work ) bool jr2_submit_getwork_result( CURL *curl, struct work *work )
{ {
json_t *val, *res; json_t *val, *res;