mirror of
https://github.com/JayDDee/cpuminer-opt.git
synced 2025-09-17 23:44:27 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
81b50c3c71 |
@@ -65,6 +65,14 @@ If not what makes it happen or not happen?
|
|||||||
Change Log
|
Change Log
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
v3.12.5
|
||||||
|
|
||||||
|
Issue #246: Fixed net hashrate in getwork block log,
|
||||||
|
removed duplicate getwork block log,
|
||||||
|
other small tweaks to stats logs for getwork.
|
||||||
|
|
||||||
|
Issue #248: Fixed chronic stale shares with scrypt:1048576 (scryptn2).
|
||||||
|
|
||||||
v3.12.4.3
|
v3.12.4.3
|
||||||
|
|
||||||
Fixed segfault in new block log for getwork.
|
Fixed segfault in new block log for getwork.
|
||||||
|
@@ -380,7 +380,7 @@ static inline void PBKDF2_SHA256_128_32_8way(uint32_t *tstate,
|
|||||||
#endif /* HAVE_SHA256_8WAY */
|
#endif /* HAVE_SHA256_8WAY */
|
||||||
|
|
||||||
|
|
||||||
#if defined(USE_ASM) && defined(__x86_64__)
|
//#if defined(USE_ASM) && defined(__x86_64__)
|
||||||
|
|
||||||
#define SCRYPT_MAX_WAYS 12
|
#define SCRYPT_MAX_WAYS 12
|
||||||
#define HAVE_SCRYPT_3WAY 1
|
#define HAVE_SCRYPT_3WAY 1
|
||||||
@@ -394,113 +394,6 @@ void scrypt_core_3way(uint32_t *X, uint32_t *V, int N);
|
|||||||
void scrypt_core_6way(uint32_t *X, uint32_t *V, int N);
|
void scrypt_core_6way(uint32_t *X, uint32_t *V, int N);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(USE_ASM) && defined(__i386__)
|
|
||||||
|
|
||||||
#define SCRYPT_MAX_WAYS 4
|
|
||||||
#define scrypt_best_throughput() 1
|
|
||||||
void scrypt_core(uint32_t *X, uint32_t *V, int N);
|
|
||||||
|
|
||||||
#elif defined(USE_ASM) && defined(__arm__) && defined(__APCS_32__)
|
|
||||||
|
|
||||||
void scrypt_core(uint32_t *X, uint32_t *V, int N);
|
|
||||||
#if defined(__ARM_NEON__)
|
|
||||||
#undef HAVE_SHA256_4WAY
|
|
||||||
#define SCRYPT_MAX_WAYS 3
|
|
||||||
#define HAVE_SCRYPT_3WAY 1
|
|
||||||
#define scrypt_best_throughput() 3
|
|
||||||
void scrypt_core_3way(uint32_t *X, uint32_t *V, int N);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static inline void xor_salsa8(uint32_t B[16], const uint32_t Bx[16])
|
|
||||||
{
|
|
||||||
uint32_t x00,x01,x02,x03,x04,x05,x06,x07,x08,x09,x10,x11,x12,x13,x14,x15;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
x00 = (B[ 0] ^= Bx[ 0]);
|
|
||||||
x01 = (B[ 1] ^= Bx[ 1]);
|
|
||||||
x02 = (B[ 2] ^= Bx[ 2]);
|
|
||||||
x03 = (B[ 3] ^= Bx[ 3]);
|
|
||||||
x04 = (B[ 4] ^= Bx[ 4]);
|
|
||||||
x05 = (B[ 5] ^= Bx[ 5]);
|
|
||||||
x06 = (B[ 6] ^= Bx[ 6]);
|
|
||||||
x07 = (B[ 7] ^= Bx[ 7]);
|
|
||||||
x08 = (B[ 8] ^= Bx[ 8]);
|
|
||||||
x09 = (B[ 9] ^= Bx[ 9]);
|
|
||||||
x10 = (B[10] ^= Bx[10]);
|
|
||||||
x11 = (B[11] ^= Bx[11]);
|
|
||||||
x12 = (B[12] ^= Bx[12]);
|
|
||||||
x13 = (B[13] ^= Bx[13]);
|
|
||||||
x14 = (B[14] ^= Bx[14]);
|
|
||||||
x15 = (B[15] ^= Bx[15]);
|
|
||||||
for (i = 0; i < 8; i += 2) {
|
|
||||||
#define R(a, b) (((a) << (b)) | ((a) >> (32 - (b))))
|
|
||||||
/* Operate on columns. */
|
|
||||||
x04 ^= R(x00+x12, 7); x09 ^= R(x05+x01, 7);
|
|
||||||
x14 ^= R(x10+x06, 7); x03 ^= R(x15+x11, 7);
|
|
||||||
|
|
||||||
x08 ^= R(x04+x00, 9); x13 ^= R(x09+x05, 9);
|
|
||||||
x02 ^= R(x14+x10, 9); x07 ^= R(x03+x15, 9);
|
|
||||||
|
|
||||||
x12 ^= R(x08+x04,13); x01 ^= R(x13+x09,13);
|
|
||||||
x06 ^= R(x02+x14,13); x11 ^= R(x07+x03,13);
|
|
||||||
|
|
||||||
x00 ^= R(x12+x08,18); x05 ^= R(x01+x13,18);
|
|
||||||
x10 ^= R(x06+x02,18); x15 ^= R(x11+x07,18);
|
|
||||||
|
|
||||||
/* Operate on rows. */
|
|
||||||
x01 ^= R(x00+x03, 7); x06 ^= R(x05+x04, 7);
|
|
||||||
x11 ^= R(x10+x09, 7); x12 ^= R(x15+x14, 7);
|
|
||||||
|
|
||||||
x02 ^= R(x01+x00, 9); x07 ^= R(x06+x05, 9);
|
|
||||||
x08 ^= R(x11+x10, 9); x13 ^= R(x12+x15, 9);
|
|
||||||
|
|
||||||
x03 ^= R(x02+x01,13); x04 ^= R(x07+x06,13);
|
|
||||||
x09 ^= R(x08+x11,13); x14 ^= R(x13+x12,13);
|
|
||||||
|
|
||||||
x00 ^= R(x03+x02,18); x05 ^= R(x04+x07,18);
|
|
||||||
x10 ^= R(x09+x08,18); x15 ^= R(x14+x13,18);
|
|
||||||
#undef R
|
|
||||||
}
|
|
||||||
B[ 0] += x00;
|
|
||||||
B[ 1] += x01;
|
|
||||||
B[ 2] += x02;
|
|
||||||
B[ 3] += x03;
|
|
||||||
B[ 4] += x04;
|
|
||||||
B[ 5] += x05;
|
|
||||||
B[ 6] += x06;
|
|
||||||
B[ 7] += x07;
|
|
||||||
B[ 8] += x08;
|
|
||||||
B[ 9] += x09;
|
|
||||||
B[10] += x10;
|
|
||||||
B[11] += x11;
|
|
||||||
B[12] += x12;
|
|
||||||
B[13] += x13;
|
|
||||||
B[14] += x14;
|
|
||||||
B[15] += x15;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void scrypt_core(uint32_t *X, uint32_t *V, int N)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < N; i++) {
|
|
||||||
memcpy(&V[i * 32], X, 128);
|
|
||||||
xor_salsa8(&X[0], &X[16]);
|
|
||||||
xor_salsa8(&X[16], &X[0]);
|
|
||||||
}
|
|
||||||
for (i = 0; i < N; i++) {
|
|
||||||
uint32_t j = 32 * (X[16] & (N - 1));
|
|
||||||
for (uint8_t k = 0; k < 32; k++)
|
|
||||||
X[k] ^= V[j + k];
|
|
||||||
xor_salsa8(&X[0], &X[16]);
|
|
||||||
xor_salsa8(&X[16], &X[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SCRYPT_MAX_WAYS
|
#ifndef SCRYPT_MAX_WAYS
|
||||||
#define SCRYPT_MAX_WAYS 1
|
#define SCRYPT_MAX_WAYS 1
|
||||||
#define scrypt_best_throughput() 1
|
#define scrypt_best_throughput() 1
|
||||||
@@ -511,8 +404,8 @@ unsigned char *scrypt_buffer_alloc(int N)
|
|||||||
return (uchar*) malloc((size_t)N * SCRYPT_MAX_WAYS * 128 + 63);
|
return (uchar*) malloc((size_t)N * SCRYPT_MAX_WAYS * 128 + 63);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scrypt_1024_1_1_256(const uint32_t *input, uint32_t *output,
|
static bool scrypt_1024_1_1_256(const uint32_t *input, uint32_t *output,
|
||||||
uint32_t *midstate, unsigned char *scratchpad, int N)
|
uint32_t *midstate, unsigned char *scratchpad, int N, int thr_id )
|
||||||
{
|
{
|
||||||
uint32_t tstate[8], ostate[8];
|
uint32_t tstate[8], ostate[8];
|
||||||
uint32_t X[32];
|
uint32_t X[32];
|
||||||
@@ -527,11 +420,13 @@ static void scrypt_1024_1_1_256(const uint32_t *input, uint32_t *output,
|
|||||||
scrypt_core(X, V, N);
|
scrypt_core(X, V, N);
|
||||||
|
|
||||||
PBKDF2_SHA256_128_32(tstate, ostate, X, output);
|
PBKDF2_SHA256_128_32(tstate, ostate, X, output);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SHA256_4WAY
|
#ifdef HAVE_SHA256_4WAY
|
||||||
static void scrypt_1024_1_1_256_4way(const uint32_t *input,
|
static bool scrypt_1024_1_1_256_4way(const uint32_t *input,
|
||||||
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
|
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N,
|
||||||
|
int thrid )
|
||||||
{
|
{
|
||||||
uint32_t _ALIGN(128) tstate[4 * 8];
|
uint32_t _ALIGN(128) tstate[4 * 8];
|
||||||
uint32_t _ALIGN(128) ostate[4 * 8];
|
uint32_t _ALIGN(128) ostate[4 * 8];
|
||||||
@@ -548,29 +443,38 @@ static void scrypt_1024_1_1_256_4way(const uint32_t *input,
|
|||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
tstate[4 * i + k] = midstate[i];
|
tstate[4 * i + k] = midstate[i];
|
||||||
|
|
||||||
HMAC_SHA256_80_init_4way(W, tstate, ostate);
|
HMAC_SHA256_80_init_4way(W, tstate, ostate);
|
||||||
|
|
||||||
PBKDF2_SHA256_80_128_4way(tstate, ostate, W, W);
|
PBKDF2_SHA256_80_128_4way(tstate, ostate, W, W);
|
||||||
|
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
X[k * 32 + i] = W[4 * i + k];
|
X[k * 32 + i] = W[4 * i + k];
|
||||||
|
|
||||||
scrypt_core(X + 0 * 32, V, N);
|
scrypt_core(X + 0 * 32, V, N);
|
||||||
scrypt_core(X + 1 * 32, V, N);
|
scrypt_core(X + 1 * 32, V, N);
|
||||||
scrypt_core(X + 2 * 32, V, N);
|
scrypt_core(X + 2 * 32, V, N);
|
||||||
scrypt_core(X + 3 * 32, V, N);
|
scrypt_core(X + 3 * 32, V, N);
|
||||||
|
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
W[4 * i + k] = X[k * 32 + i];
|
W[4 * i + k] = X[k * 32 + i];
|
||||||
|
|
||||||
PBKDF2_SHA256_128_32_4way(tstate, ostate, W, W);
|
PBKDF2_SHA256_128_32_4way(tstate, ostate, W, W);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
output[k * 8 + i] = W[4 * i + k];
|
output[k * 8 + i] = W[4 * i + k];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_SHA256_4WAY */
|
#endif /* HAVE_SHA256_4WAY */
|
||||||
|
|
||||||
#ifdef HAVE_SCRYPT_3WAY
|
#ifdef HAVE_SCRYPT_3WAY
|
||||||
|
|
||||||
static void scrypt_1024_1_1_256_3way(const uint32_t *input,
|
static bool scrypt_1024_1_1_256_3way(const uint32_t *input,
|
||||||
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
|
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N,
|
||||||
|
int thrid )
|
||||||
{
|
{
|
||||||
uint32_t _ALIGN(64) tstate[3 * 8], ostate[3 * 8];
|
uint32_t _ALIGN(64) tstate[3 * 8], ostate[3 * 8];
|
||||||
uint32_t _ALIGN(64) X[3 * 32];
|
uint32_t _ALIGN(64) X[3 * 32];
|
||||||
@@ -581,23 +485,33 @@ static void scrypt_1024_1_1_256_3way(const uint32_t *input,
|
|||||||
memcpy(tstate + 0, midstate, 32);
|
memcpy(tstate + 0, midstate, 32);
|
||||||
memcpy(tstate + 8, midstate, 32);
|
memcpy(tstate + 8, midstate, 32);
|
||||||
memcpy(tstate + 16, midstate, 32);
|
memcpy(tstate + 16, midstate, 32);
|
||||||
|
|
||||||
HMAC_SHA256_80_init(input + 0, tstate + 0, ostate + 0);
|
HMAC_SHA256_80_init(input + 0, tstate + 0, ostate + 0);
|
||||||
HMAC_SHA256_80_init(input + 20, tstate + 8, ostate + 8);
|
HMAC_SHA256_80_init(input + 20, tstate + 8, ostate + 8);
|
||||||
HMAC_SHA256_80_init(input + 40, tstate + 16, ostate + 16);
|
HMAC_SHA256_80_init(input + 40, tstate + 16, ostate + 16);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
PBKDF2_SHA256_80_128(tstate + 0, ostate + 0, input + 0, X + 0);
|
PBKDF2_SHA256_80_128(tstate + 0, ostate + 0, input + 0, X + 0);
|
||||||
PBKDF2_SHA256_80_128(tstate + 8, ostate + 8, input + 20, X + 32);
|
PBKDF2_SHA256_80_128(tstate + 8, ostate + 8, input + 20, X + 32);
|
||||||
PBKDF2_SHA256_80_128(tstate + 16, ostate + 16, input + 40, X + 64);
|
PBKDF2_SHA256_80_128(tstate + 16, ostate + 16, input + 40, X + 64);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
scrypt_core_3way(X, V, N);
|
scrypt_core_3way(X, V, N);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
PBKDF2_SHA256_128_32(tstate + 0, ostate + 0, X + 0, output + 0);
|
PBKDF2_SHA256_128_32(tstate + 0, ostate + 0, X + 0, output + 0);
|
||||||
PBKDF2_SHA256_128_32(tstate + 8, ostate + 8, X + 32, output + 8);
|
PBKDF2_SHA256_128_32(tstate + 8, ostate + 8, X + 32, output + 8);
|
||||||
PBKDF2_SHA256_128_32(tstate + 16, ostate + 16, X + 64, output + 16);
|
PBKDF2_SHA256_128_32(tstate + 16, ostate + 16, X + 64, output + 16);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SHA256_4WAY
|
#ifdef HAVE_SHA256_4WAY
|
||||||
static void scrypt_1024_1_1_256_12way(const uint32_t *input,
|
static bool scrypt_1024_1_1_256_12way(const uint32_t *input,
|
||||||
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
|
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N,
|
||||||
|
int thrid )
|
||||||
{
|
{
|
||||||
uint32_t _ALIGN(128) tstate[12 * 8];
|
uint32_t _ALIGN(128) tstate[12 * 8];
|
||||||
uint32_t _ALIGN(128) ostate[12 * 8];
|
uint32_t _ALIGN(128) ostate[12 * 8];
|
||||||
@@ -616,39 +530,54 @@ static void scrypt_1024_1_1_256_12way(const uint32_t *input,
|
|||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
tstate[32 * j + 4 * i + k] = midstate[i];
|
tstate[32 * j + 4 * i + k] = midstate[i];
|
||||||
|
|
||||||
HMAC_SHA256_80_init_4way(W + 0, tstate + 0, ostate + 0);
|
HMAC_SHA256_80_init_4way(W + 0, tstate + 0, ostate + 0);
|
||||||
HMAC_SHA256_80_init_4way(W + 128, tstate + 32, ostate + 32);
|
HMAC_SHA256_80_init_4way(W + 128, tstate + 32, ostate + 32);
|
||||||
HMAC_SHA256_80_init_4way(W + 256, tstate + 64, ostate + 64);
|
HMAC_SHA256_80_init_4way(W + 256, tstate + 64, ostate + 64);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
PBKDF2_SHA256_80_128_4way(tstate + 0, ostate + 0, W + 0, W + 0);
|
PBKDF2_SHA256_80_128_4way(tstate + 0, ostate + 0, W + 0, W + 0);
|
||||||
PBKDF2_SHA256_80_128_4way(tstate + 32, ostate + 32, W + 128, W + 128);
|
PBKDF2_SHA256_80_128_4way(tstate + 32, ostate + 32, W + 128, W + 128);
|
||||||
PBKDF2_SHA256_80_128_4way(tstate + 64, ostate + 64, W + 256, W + 256);
|
PBKDF2_SHA256_80_128_4way(tstate + 64, ostate + 64, W + 256, W + 256);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
X[128 * j + k * 32 + i] = W[128 * j + 4 * i + k];
|
X[128 * j + k * 32 + i] = W[128 * j + 4 * i + k];
|
||||||
|
|
||||||
scrypt_core_3way(X + 0 * 96, V, N);
|
scrypt_core_3way(X + 0 * 96, V, N);
|
||||||
scrypt_core_3way(X + 1 * 96, V, N);
|
scrypt_core_3way(X + 1 * 96, V, N);
|
||||||
scrypt_core_3way(X + 2 * 96, V, N);
|
scrypt_core_3way(X + 2 * 96, V, N);
|
||||||
scrypt_core_3way(X + 3 * 96, V, N);
|
scrypt_core_3way(X + 3 * 96, V, N);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
W[128 * j + 4 * i + k] = X[128 * j + k * 32 + i];
|
W[128 * j + 4 * i + k] = X[128 * j + k * 32 + i];
|
||||||
|
|
||||||
PBKDF2_SHA256_128_32_4way(tstate + 0, ostate + 0, W + 0, W + 0);
|
PBKDF2_SHA256_128_32_4way(tstate + 0, ostate + 0, W + 0, W + 0);
|
||||||
PBKDF2_SHA256_128_32_4way(tstate + 32, ostate + 32, W + 128, W + 128);
|
PBKDF2_SHA256_128_32_4way(tstate + 32, ostate + 32, W + 128, W + 128);
|
||||||
PBKDF2_SHA256_128_32_4way(tstate + 64, ostate + 64, W + 256, W + 256);
|
PBKDF2_SHA256_128_32_4way(tstate + 64, ostate + 64, W + 256, W + 256);
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
for (k = 0; k < 4; k++)
|
for (k = 0; k < 4; k++)
|
||||||
output[32 * j + k * 8 + i] = W[128 * j + 4 * i + k];
|
output[32 * j + k * 8 + i] = W[128 * j + 4 * i + k];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_SHA256_4WAY */
|
#endif /* HAVE_SHA256_4WAY */
|
||||||
|
|
||||||
#endif /* HAVE_SCRYPT_3WAY */
|
#endif /* HAVE_SCRYPT_3WAY */
|
||||||
|
|
||||||
#ifdef HAVE_SCRYPT_6WAY
|
#ifdef HAVE_SCRYPT_6WAY
|
||||||
static void scrypt_1024_1_1_256_24way(const uint32_t *input,
|
static bool scrypt_1024_1_1_256_24way(const uint32_t *input,
|
||||||
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N)
|
uint32_t *output, uint32_t *midstate, unsigned char *scratchpad, int N,
|
||||||
|
int thrid )
|
||||||
{
|
{
|
||||||
uint32_t _ALIGN(128) tstate[24 * 8];
|
uint32_t _ALIGN(128) tstate[24 * 8];
|
||||||
uint32_t _ALIGN(128) ostate[24 * 8];
|
uint32_t _ALIGN(128) ostate[24 * 8];
|
||||||
@@ -667,31 +596,45 @@ static void scrypt_1024_1_1_256_24way(const uint32_t *input,
|
|||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
for (k = 0; k < 8; k++)
|
for (k = 0; k < 8; k++)
|
||||||
tstate[8 * 8 * j + 8 * i + k] = midstate[i];
|
tstate[8 * 8 * j + 8 * i + k] = midstate[i];
|
||||||
|
|
||||||
HMAC_SHA256_80_init_8way(W + 0, tstate + 0, ostate + 0);
|
HMAC_SHA256_80_init_8way(W + 0, tstate + 0, ostate + 0);
|
||||||
HMAC_SHA256_80_init_8way(W + 256, tstate + 64, ostate + 64);
|
HMAC_SHA256_80_init_8way(W + 256, tstate + 64, ostate + 64);
|
||||||
HMAC_SHA256_80_init_8way(W + 512, tstate + 128, ostate + 128);
|
HMAC_SHA256_80_init_8way(W + 512, tstate + 128, ostate + 128);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
PBKDF2_SHA256_80_128_8way(tstate + 0, ostate + 0, W + 0, W + 0);
|
PBKDF2_SHA256_80_128_8way(tstate + 0, ostate + 0, W + 0, W + 0);
|
||||||
PBKDF2_SHA256_80_128_8way(tstate + 64, ostate + 64, W + 256, W + 256);
|
PBKDF2_SHA256_80_128_8way(tstate + 64, ostate + 64, W + 256, W + 256);
|
||||||
PBKDF2_SHA256_80_128_8way(tstate + 128, ostate + 128, W + 512, W + 512);
|
PBKDF2_SHA256_80_128_8way(tstate + 128, ostate + 128, W + 512, W + 512);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
for (k = 0; k < 8; k++)
|
for (k = 0; k < 8; k++)
|
||||||
X[8 * 32 * j + k * 32 + i] = W[8 * 32 * j + 8 * i + k];
|
X[8 * 32 * j + k * 32 + i] = W[8 * 32 * j + 8 * i + k];
|
||||||
|
|
||||||
scrypt_core_6way(X + 0 * 32, V, N);
|
scrypt_core_6way(X + 0 * 32, V, N);
|
||||||
scrypt_core_6way(X + 6 * 32, V, N);
|
scrypt_core_6way(X + 6 * 32, V, N);
|
||||||
scrypt_core_6way(X + 12 * 32, V, N);
|
scrypt_core_6way(X + 12 * 32, V, N);
|
||||||
scrypt_core_6way(X + 18 * 32, V, N);
|
scrypt_core_6way(X + 18 * 32, V, N);
|
||||||
|
|
||||||
|
if ( work_restart[thrid].restart ) return false;
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
for (k = 0; k < 8; k++)
|
for (k = 0; k < 8; k++)
|
||||||
W[8 * 32 * j + 8 * i + k] = X[8 * 32 * j + k * 32 + i];
|
W[8 * 32 * j + 8 * i + k] = X[8 * 32 * j + k * 32 + i];
|
||||||
|
|
||||||
PBKDF2_SHA256_128_32_8way(tstate + 0, ostate + 0, W + 0, W + 0);
|
PBKDF2_SHA256_128_32_8way(tstate + 0, ostate + 0, W + 0, W + 0);
|
||||||
PBKDF2_SHA256_128_32_8way(tstate + 64, ostate + 64, W + 256, W + 256);
|
PBKDF2_SHA256_128_32_8way(tstate + 64, ostate + 64, W + 256, W + 256);
|
||||||
PBKDF2_SHA256_128_32_8way(tstate + 128, ostate + 128, W + 512, W + 512);
|
PBKDF2_SHA256_128_32_8way(tstate + 128, ostate + 128, W + 512, W + 512);
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
for (k = 0; k < 8; k++)
|
for (k = 0; k < 8; k++)
|
||||||
output[8 * 8 * j + k * 8 + i] = W[8 * 32 * j + 8 * i + k];
|
output[8 * 8 * j + k * 8 + i] = W[8 * 32 * j + 8 * i + k];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_SCRYPT_6WAY */
|
#endif /* HAVE_SCRYPT_6WAY */
|
||||||
|
|
||||||
@@ -703,7 +646,6 @@ extern int scanhash_scrypt( struct work *work, uint32_t max_nonce,
|
|||||||
uint32_t data[SCRYPT_MAX_WAYS * 20], hash[SCRYPT_MAX_WAYS * 8];
|
uint32_t data[SCRYPT_MAX_WAYS * 20], hash[SCRYPT_MAX_WAYS * 8];
|
||||||
uint32_t midstate[8];
|
uint32_t midstate[8];
|
||||||
uint32_t n = pdata[19] - 1;
|
uint32_t n = pdata[19] - 1;
|
||||||
const uint32_t Htarg = ptarget[7];
|
|
||||||
int thr_id = mythr->id; // thr_id arg is deprecated
|
int thr_id = mythr->id; // thr_id arg is deprecated
|
||||||
int throughput = scrypt_best_throughput();
|
int throughput = scrypt_best_throughput();
|
||||||
int i;
|
int i;
|
||||||
@@ -714,6 +656,8 @@ extern int scanhash_scrypt( struct work *work, uint32_t max_nonce,
|
|||||||
throughput *= 4;
|
throughput *= 4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// applog(LOG_INFO,"Scrypt thoughput %d",throughput);
|
||||||
|
|
||||||
for (i = 0; i < throughput; i++)
|
for (i = 0; i < throughput; i++)
|
||||||
memcpy(data + i * 20, pdata, 80);
|
memcpy(data + i * 20, pdata, 80);
|
||||||
|
|
||||||
@@ -721,46 +665,49 @@ extern int scanhash_scrypt( struct work *work, uint32_t max_nonce,
|
|||||||
sha256_transform(midstate, data, 0);
|
sha256_transform(midstate, data, 0);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
bool rc = true;
|
||||||
for (i = 0; i < throughput; i++)
|
for (i = 0; i < throughput; i++)
|
||||||
data[i * 20 + 19] = ++n;
|
data[i * 20 + 19] = ++n;
|
||||||
|
|
||||||
#if defined(HAVE_SHA256_4WAY)
|
#if defined(HAVE_SHA256_4WAY)
|
||||||
if (throughput == 4)
|
if (throughput == 4)
|
||||||
scrypt_1024_1_1_256_4way(data, hash, midstate,
|
rc = scrypt_1024_1_1_256_4way(data, hash, midstate,
|
||||||
scratchbuf, scratchbuf_size );
|
scratchbuf, scratchbuf_size, thr_id );
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_SCRYPT_3WAY) && defined(HAVE_SHA256_4WAY)
|
#if defined(HAVE_SCRYPT_3WAY) && defined(HAVE_SHA256_4WAY)
|
||||||
if (throughput == 12)
|
if (throughput == 12)
|
||||||
scrypt_1024_1_1_256_12way(data, hash, midstate,
|
rc = scrypt_1024_1_1_256_12way(data, hash, midstate,
|
||||||
scratchbuf, scratchbuf_size );
|
scratchbuf, scratchbuf_size, thr_id );
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_SCRYPT_6WAY)
|
#if defined(HAVE_SCRYPT_6WAY)
|
||||||
if (throughput == 24)
|
if (throughput == 24)
|
||||||
scrypt_1024_1_1_256_24way(data, hash, midstate,
|
rc = scrypt_1024_1_1_256_24way(data, hash, midstate,
|
||||||
scratchbuf, scratchbuf_size );
|
scratchbuf, scratchbuf_size, thr_id );
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_SCRYPT_3WAY)
|
#if defined(HAVE_SCRYPT_3WAY)
|
||||||
if (throughput == 3)
|
if (throughput == 3)
|
||||||
scrypt_1024_1_1_256_3way(data, hash, midstate,
|
rc = scrypt_1024_1_1_256_3way(data, hash, midstate,
|
||||||
scratchbuf, scratchbuf_size );
|
scratchbuf, scratchbuf_size, thr_id );
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
scrypt_1024_1_1_256(data, hash, midstate, scratchbuf,
|
rc = scrypt_1024_1_1_256(data, hash, midstate, scratchbuf,
|
||||||
scratchbuf_size );
|
scratchbuf_size, thr_id );
|
||||||
|
|
||||||
for (i = 0; i < throughput; i++) {
|
if ( rc )
|
||||||
if (unlikely(hash[i * 8 + 7] <= Htarg && fulltest(hash + i * 8, ptarget))) {
|
for ( i = 0; i < throughput; i++ )
|
||||||
|
{
|
||||||
|
if ( unlikely( valid_hash( hash + i * 8, ptarget ) ) )
|
||||||
|
{
|
||||||
pdata[19] = data[i * 20 + 19];
|
pdata[19] = data[i * 20 + 19];
|
||||||
submit_solution( work, hash, mythr );
|
submit_lane_solution( work, hash, mythr, i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while ( likely( n < max_nonce && !(*restart) ) );
|
} while ( likely( ( n < ( max_nonce - throughput ) ) && !(*restart) ) );
|
||||||
|
|
||||||
*hashes_done = n - pdata[19] + 1;
|
*hashes_done = n - pdata[19];
|
||||||
pdata[19] = n;
|
pdata[19] = n;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -779,7 +726,6 @@ bool register_scrypt_algo( algo_gate_t* gate )
|
|||||||
gate->optimizations = SSE2_OPT | AVX2_OPT;
|
gate->optimizations = SSE2_OPT | AVX2_OPT;
|
||||||
gate->miner_thread_init =(void*)&scrypt_miner_thread_init;
|
gate->miner_thread_init =(void*)&scrypt_miner_thread_init;
|
||||||
gate->scanhash = (void*)&scanhash_scrypt;
|
gate->scanhash = (void*)&scanhash_scrypt;
|
||||||
// gate->hash = (void*)&scrypt_1024_1_1_256_24way;
|
|
||||||
opt_target_factor = 65536.0;
|
opt_target_factor = 65536.0;
|
||||||
|
|
||||||
if ( !opt_param_n )
|
if ( !opt_param_n )
|
||||||
|
20
configure
vendored
20
configure
vendored
@@ -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.3.
|
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.4.4.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# 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.3'
|
PACKAGE_VERSION='3.12.4.4'
|
||||||
PACKAGE_STRING='cpuminer-opt 3.12.4.3'
|
PACKAGE_STRING='cpuminer-opt 3.12.4.4'
|
||||||
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.3 to adapt to many kinds of systems.
|
\`configure' configures cpuminer-opt 3.12.4.4 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.3:";;
|
short | recursive ) echo "Configuration of cpuminer-opt 3.12.4.4:";;
|
||||||
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.3
|
cpuminer-opt configure 3.12.4.4
|
||||||
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.3, which was
|
It was created by cpuminer-opt $as_me 3.12.4.4, 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.3'
|
VERSION='3.12.4.4'
|
||||||
|
|
||||||
|
|
||||||
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.3, which was
|
This file was extended by cpuminer-opt $as_me 3.12.4.4, 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.3
|
cpuminer-opt config.status 3.12.4.4
|
||||||
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\\"
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT([cpuminer-opt], [3.12.4.3])
|
AC_INIT([cpuminer-opt], [3.12.4.4])
|
||||||
|
|
||||||
AC_PREREQ([2.59c])
|
AC_PREREQ([2.59c])
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
|
80
cpu-miner.c
80
cpu-miner.c
@@ -184,6 +184,22 @@ int default_api_listen = 4048;
|
|||||||
pthread_mutex_t applog_lock;
|
pthread_mutex_t applog_lock;
|
||||||
pthread_mutex_t stats_lock;
|
pthread_mutex_t stats_lock;
|
||||||
|
|
||||||
|
static struct timeval session_start;
|
||||||
|
static struct timeval five_min_start;
|
||||||
|
static uint64_t session_first_block = 0;
|
||||||
|
static double latency_sum = 0.;
|
||||||
|
static uint64_t submit_sum = 0;
|
||||||
|
static uint64_t accept_sum = 0;
|
||||||
|
static uint64_t stale_sum = 0;
|
||||||
|
static uint64_t reject_sum = 0;
|
||||||
|
static double norm_diff_sum = 0.;
|
||||||
|
static uint32_t last_block_height = 0;
|
||||||
|
//static bool new_job = false;
|
||||||
|
static double last_targetdiff = 0.;
|
||||||
|
#if !(defined(__WINDOWS__) || defined(_WIN64) || defined(_WIN32))
|
||||||
|
static uint32_t hi_temp = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static char const short_options[] =
|
static char const short_options[] =
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
@@ -421,7 +437,9 @@ static bool work_decode( const json_t *val, struct work *work )
|
|||||||
net_diff = algo_gate.calc_network_diff( work );
|
net_diff = algo_gate.calc_network_diff( work );
|
||||||
work->targetdiff = target_to_diff( work->target );
|
work->targetdiff = target_to_diff( work->target );
|
||||||
// for api stats, on longpoll pools
|
// for api stats, on longpoll pools
|
||||||
stratum_diff = work->targetdiff;
|
// This needs cleanup, stratum_diff doean't apply solo mining
|
||||||
|
// and targetdiff is redundant, same as net_diff.
|
||||||
|
stratum_diff = last_targetdiff = work->targetdiff;
|
||||||
work->sharediff = 0;
|
work->sharediff = 0;
|
||||||
algo_gate.decode_extra_data( work, &net_blocks );
|
algo_gate.decode_extra_data( work, &net_blocks );
|
||||||
return true;
|
return true;
|
||||||
@@ -478,6 +496,8 @@ static bool get_mininginfo( CURL *curl, struct work *work )
|
|||||||
if ( work->height > g_work.height )
|
if ( work->height > g_work.height )
|
||||||
{
|
{
|
||||||
restart_threads();
|
restart_threads();
|
||||||
|
|
||||||
|
/* redundant with new block log
|
||||||
if ( !opt_quiet )
|
if ( !opt_quiet )
|
||||||
{
|
{
|
||||||
char netinfo[64] = { 0 };
|
char netinfo[64] = { 0 };
|
||||||
@@ -492,6 +512,7 @@ static bool get_mininginfo( CURL *curl, struct work *work )
|
|||||||
applog( LOG_BLUE, "%s block %d, %s",
|
applog( LOG_BLUE, "%s block %d, %s",
|
||||||
algo_names[opt_algo], work->height, netinfo );
|
algo_names[opt_algo], work->height, netinfo );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
} // res
|
} // res
|
||||||
}
|
}
|
||||||
@@ -880,23 +901,6 @@ static inline void sprintf_et( char *str, int seconds )
|
|||||||
|
|
||||||
const double diff_to_hash = 4294967296.;
|
const double diff_to_hash = 4294967296.;
|
||||||
|
|
||||||
static struct timeval session_start;
|
|
||||||
static struct timeval five_min_start;
|
|
||||||
static uint64_t session_first_block = 0;
|
|
||||||
static double latency_sum = 0.;
|
|
||||||
static uint64_t submit_sum = 0;
|
|
||||||
static uint64_t accept_sum = 0;
|
|
||||||
static uint64_t stale_sum = 0;
|
|
||||||
static uint64_t reject_sum = 0;
|
|
||||||
static double norm_diff_sum = 0.;
|
|
||||||
static uint32_t last_block_height = 0;
|
|
||||||
//static bool new_job = false;
|
|
||||||
static double last_targetdiff = 0.;
|
|
||||||
#if !(defined(__WINDOWS__) || defined(_WIN64) || defined(_WIN32))
|
|
||||||
static uint32_t hi_temp = 0;
|
|
||||||
#endif
|
|
||||||
//static uint32_t stratum_errors = 0;
|
|
||||||
|
|
||||||
struct share_stats_t
|
struct share_stats_t
|
||||||
{
|
{
|
||||||
int share_count;
|
int share_count;
|
||||||
@@ -970,6 +974,7 @@ void report_summary_log( bool force )
|
|||||||
sprintf_et( upt_str, uptime.tv_sec );
|
sprintf_et( upt_str, uptime.tv_sec );
|
||||||
|
|
||||||
applog( LOG_NOTICE, "Periodic Report %s %s", et_str, upt_str );
|
applog( LOG_NOTICE, "Periodic Report %s %s", et_str, upt_str );
|
||||||
|
applog2( LOG_INFO, "%s: %s", algo_names[ opt_algo ], short_url );
|
||||||
applog2( LOG_INFO, "Share rate %.2f/min %.2f/min",
|
applog2( LOG_INFO, "Share rate %.2f/min %.2f/min",
|
||||||
submit_rate, (double)submitted_share_count*60. /
|
submit_rate, (double)submitted_share_count*60. /
|
||||||
( (double)uptime.tv_sec + (double)uptime.tv_usec / 1e6 ) );
|
( (double)uptime.tv_sec + (double)uptime.tv_usec / 1e6 ) );
|
||||||
@@ -1507,8 +1512,7 @@ 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", algo_names[ opt_algo ],
|
applog( LOG_BLUE, "New block %d, diff %.5g", work->height, net_diff );
|
||||||
short_url, work->height, net_diff );
|
|
||||||
|
|
||||||
if ( !opt_quiet && net_diff && net_hashrate )
|
if ( !opt_quiet && net_diff && net_hashrate )
|
||||||
{
|
{
|
||||||
@@ -1523,18 +1527,19 @@ start:
|
|||||||
|
|
||||||
if ( miner_hr )
|
if ( miner_hr )
|
||||||
{
|
{
|
||||||
|
double net_hr = net_hashrate;
|
||||||
char net_hr_units[4] = {0};
|
char net_hr_units[4] = {0};
|
||||||
char miner_hr_units[4] = {0};
|
char miner_hr_units[4] = {0};
|
||||||
char net_ttf[32];
|
char net_ttf[32];
|
||||||
char miner_ttf[32];
|
char miner_ttf[32];
|
||||||
|
|
||||||
sprintf_et( net_ttf, net_diff * diff_to_hash / net_hashrate );
|
sprintf_et( net_ttf, net_diff * diff_to_hash / net_hr );
|
||||||
sprintf_et( miner_ttf, net_diff * diff_to_hash / miner_hr );
|
sprintf_et( miner_ttf, net_diff * diff_to_hash / miner_hr );
|
||||||
scale_hash_for_display ( &miner_hr, miner_hr_units );
|
scale_hash_for_display ( &miner_hr, miner_hr_units );
|
||||||
scale_hash_for_display ( &net_hashrate, net_hr_units );
|
scale_hash_for_display ( &net_hr, net_hr_units );
|
||||||
applog2(LOG_INFO, "Miner TTF @ %.2f %sh/s %s, net TTF @ %.2f %sh/s %s",
|
applog2(LOG_INFO, "Miner TTF @ %.2f %sh/s %s, net TTF @ %.2f %sh/s %s",
|
||||||
miner_hr, miner_hr_units, miner_ttf,
|
miner_hr, miner_hr_units, miner_ttf,
|
||||||
net_hashrate, net_hr_units, net_ttf );
|
net_hr, net_hr_units, net_ttf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@@ -1558,36 +1563,36 @@ static void workio_cmd_free(struct workio_cmd *wc)
|
|||||||
free(wc);
|
free(wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool workio_get_work(struct workio_cmd *wc, CURL *curl)
|
static bool workio_get_work( struct workio_cmd *wc, CURL *curl )
|
||||||
{
|
{
|
||||||
struct work *ret_work;
|
struct work *ret_work;
|
||||||
int failures = 0;
|
int failures = 0;
|
||||||
|
|
||||||
ret_work = (struct work*) calloc(1, sizeof(*ret_work));
|
ret_work = (struct work*) calloc( 1, sizeof(*ret_work) );
|
||||||
if (!ret_work)
|
if ( !ret_work )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* obtain new work from bitcoin via JSON-RPC */
|
/* obtain new work from bitcoin via JSON-RPC */
|
||||||
while (!get_upstream_work(curl, ret_work))
|
while ( !get_upstream_work( curl, ret_work ) )
|
||||||
{
|
{
|
||||||
if (unlikely((opt_retries >= 0) && (++failures > opt_retries)))
|
if ( unlikely( ( opt_retries >= 0 ) && ( ++failures > opt_retries ) ) )
|
||||||
{
|
{
|
||||||
applog(LOG_ERR, "json_rpc_call failed, terminating workio thread");
|
applog( LOG_ERR, "json_rpc_call failed, terminating workio thread" );
|
||||||
free(ret_work);
|
free( ret_work );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pause, then restart work-request loop */
|
/* pause, then restart work-request loop */
|
||||||
applog(LOG_ERR, "json_rpc_call failed, retry after %d seconds",
|
applog( LOG_ERR, "json_rpc_call failed, retry after %d seconds",
|
||||||
opt_fail_pause);
|
opt_fail_pause );
|
||||||
sleep(opt_fail_pause);
|
sleep( opt_fail_pause );
|
||||||
}
|
}
|
||||||
|
|
||||||
report_summary_log( false );
|
|
||||||
|
|
||||||
/* send work to requesting thread */
|
/* send work to requesting thread */
|
||||||
if (!tq_push(wc->thr->q, ret_work))
|
if ( !tq_push(wc->thr->q, ret_work ) )
|
||||||
free(ret_work);
|
free( ret_work );
|
||||||
|
|
||||||
|
report_summary_log( false );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2609,7 +2614,6 @@ void std_stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work )
|
|||||||
|
|
||||||
if ( !opt_quiet )
|
if ( !opt_quiet )
|
||||||
{
|
{
|
||||||
applog2( LOG_INFO, "%s: %s", algo_names[opt_algo], short_url );
|
|
||||||
applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g",
|
applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g",
|
||||||
net_diff, stratum_diff, last_targetdiff );
|
net_diff, stratum_diff, last_targetdiff );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user