mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-11 05:32:16 +00:00
Revert "Use cpu scrypt code to check if an scrypt share is below target before submitting it."
This reverts commit 808f403a14267263066b0c257c262a1be6ef47ca. Conflicts: findnonce.c
This commit is contained in:
parent
a22edd2a7f
commit
b9e5f8e550
@ -45,10 +45,6 @@ cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
|
|||||||
cgminer_SOURCES += adl.c adl.h adl_functions.h
|
cgminer_SOURCES += adl.c adl.h adl_functions.h
|
||||||
cgminer_SOURCES += *.cl
|
cgminer_SOURCES += *.cl
|
||||||
|
|
||||||
if HAS_SCRYPT
|
|
||||||
cgminer_SOURCES += scrypt.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if HAS_CPUMINE
|
if HAS_CPUMINE
|
||||||
# original CPU related sources, unchanged
|
# original CPU related sources, unchanged
|
||||||
cgminer_SOURCES += \
|
cgminer_SOURCES += \
|
||||||
@ -60,6 +56,10 @@ cgminer_SOURCES += \
|
|||||||
# the CPU portion extracted from original main.c
|
# the CPU portion extracted from original main.c
|
||||||
cgminer_SOURCES += driver-cpu.h driver-cpu.c
|
cgminer_SOURCES += driver-cpu.h driver-cpu.c
|
||||||
|
|
||||||
|
if HAS_SCRYPT
|
||||||
|
cgminer_SOURCES += scrypt.c
|
||||||
|
endif
|
||||||
|
|
||||||
if HAS_YASM
|
if HAS_YASM
|
||||||
AM_CFLAGS = -DHAS_YASM
|
AM_CFLAGS = -DHAS_YASM
|
||||||
if HAVE_x86_64
|
if HAVE_x86_64
|
||||||
|
@ -4012,7 +4012,7 @@ bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
|
|||||||
/* Do one last check before attempting to submit the work */
|
/* Do one last check before attempting to submit the work */
|
||||||
/* Side effect: sets work->data for us */
|
/* Side effect: sets work->data for us */
|
||||||
if (!test_nonce(work, nonce)) {
|
if (!test_nonce(work, nonce)) {
|
||||||
applog(LOG_INFO, "Pool %d share below target", work->pool->pool_no);
|
applog(LOG_INFO, "Share below target");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return submit_work_sync(thr, work);
|
return submit_work_sync(thr, work);
|
||||||
|
12
findnonce.c
12
findnonce.c
@ -220,8 +220,6 @@ static void send_nonce(struct pc_data *pcd, cl_uint nonce)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool scrypt_scan_nonce(struct work *work, uint32_t nonce);
|
|
||||||
|
|
||||||
static void *postcalc_hash(void *userdata)
|
static void *postcalc_hash(void *userdata)
|
||||||
{
|
{
|
||||||
struct pc_data *pcd = (struct pc_data *)userdata;
|
struct pc_data *pcd = (struct pc_data *)userdata;
|
||||||
@ -236,13 +234,9 @@ static void *postcalc_hash(void *userdata)
|
|||||||
if (nonce) {
|
if (nonce) {
|
||||||
applog(LOG_DEBUG, "OCL NONCE %u", nonce);
|
applog(LOG_DEBUG, "OCL NONCE %u", nonce);
|
||||||
#ifdef USE_SCRYPT
|
#ifdef USE_SCRYPT
|
||||||
if (opt_scrypt) {
|
if (opt_scrypt)
|
||||||
struct work *work = pcd->work;
|
submit_nonce(thr, pcd->work, nonce);
|
||||||
if (scrypt_scan_nonce(work, nonce))
|
else
|
||||||
submit_nonce(thr, work, nonce);
|
|
||||||
else
|
|
||||||
applog(LOG_INFO, "Pool %d share below target", work->pool->pool_no);
|
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
send_nonce(pcd, nonce);
|
send_nonce(pcd, nonce);
|
||||||
nonces++;
|
nonces++;
|
||||||
|
16
scrypt.c
16
scrypt.c
@ -407,20 +407,6 @@ static uint32_t scrypt_1024_1_1_256_sp(const uint32_t* input, char* scratchpad)
|
|||||||
return PBKDF2_SHA256_80_128_32(input, X);
|
return PBKDF2_SHA256_80_128_32(input, X);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool scrypt_scan_nonce(struct work *work, uint32_t nonce)
|
|
||||||
{
|
|
||||||
uint32_t Htarg, tmp_hash7, data[20];
|
|
||||||
unsigned char *scratchbuf;
|
|
||||||
|
|
||||||
be32enc_vect(data, (const uint32_t *)work->data, 19);
|
|
||||||
data[19] = htobe32(nonce);
|
|
||||||
|
|
||||||
Htarg = ((const uint32_t *)work->target)[7];
|
|
||||||
scratchbuf = alloca(131584);
|
|
||||||
tmp_hash7 = scrypt_1024_1_1_256_sp(data, scratchbuf);
|
|
||||||
return (tmp_hash7 <= Htarg);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool scanhash_scrypt(struct thr_info *thr, const unsigned char *pmidstate, unsigned char *pdata,
|
bool scanhash_scrypt(struct thr_info *thr, const unsigned char *pmidstate, unsigned char *pdata,
|
||||||
unsigned char *phash1, unsigned char *phash,
|
unsigned char *phash1, unsigned char *phash,
|
||||||
const unsigned char *ptarget,
|
const unsigned char *ptarget,
|
||||||
@ -437,7 +423,7 @@ bool scanhash_scrypt(struct thr_info *thr, const unsigned char *pmidstate, unsig
|
|||||||
|
|
||||||
be32enc_vect(data, (const uint32_t *)pdata, 19);
|
be32enc_vect(data, (const uint32_t *)pdata, 19);
|
||||||
|
|
||||||
scratchbuf = malloc(131584);
|
scratchbuf = malloc(131583);
|
||||||
if (unlikely(!scratchbuf)) {
|
if (unlikely(!scratchbuf)) {
|
||||||
applog(LOG_ERR, "Failed to malloc scratchbuf in scanhash_scrypt");
|
applog(LOG_ERR, "Failed to malloc scratchbuf in scanhash_scrypt");
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user