From 5e64697390c2147918bebcfa1da6727046bd17c3 Mon Sep 17 00:00:00 2001 From: djm34 Date: Fri, 25 Oct 2019 12:14:58 +0300 Subject: [PATCH] fix solo mining --- ccminer.cpp | 10 ++++++++-- compat/ccminer-config.h | 2 +- configure.ac | 2 +- cuda_mtp/mtp.cu | 15 ++++++--------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ccminer.cpp b/ccminer.cpp index 5ed22a6..bbef859 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -1741,8 +1741,8 @@ static bool gbt_work_decode_mtp(const json_t *val, struct work *work) printf("mn script %d", json_string_value(mnscript)); */ } - cbvalue = (int64_t)(json_is_integer(tmp) ? json_integer_value(tmp) : json_number_value(tmp)); + cbvalue = (uint32_t)cbvalue - (uint32_t)7000000; cbtx = (uchar*)malloc(256*256); le32enc((uint32_t *)cbtx, 1); // version / cbtx[4] = 1; // in-counter / @@ -1760,7 +1760,7 @@ static bool gbt_work_decode_mtp(const json_t *val, struct work *work) le32enc((uint32_t *)(cbtx + cbtx_size), 0xffffffff); // sequence / cbtx_size += 4; - cbtx[cbtx_size++] = (mpay && json_integer_value(mnamount)!=0)? 7:6; // out-counter / + cbtx[cbtx_size++] = (mpay && json_integer_value(mnamount)!=0)? 8:7; // out-counter / le32enc((uint32_t *)(cbtx + cbtx_size), (uint32_t)cbvalue); // value / le32enc((uint32_t *)(cbtx + cbtx_size + 4), cbvalue >> 32); @@ -1784,6 +1784,7 @@ static bool gbt_work_decode_mtp(const json_t *val, struct work *work) char coinb3[74] = { 0 }; char coinb4[74] = { 0 }; char coinb5[74] = { 0 }; + char coinb51[74] = { 0 }; char coinb6[74] = { 0 }; char coinb7[90] = { 0 }; char script_payee[1024]; @@ -1806,6 +1807,8 @@ static bool gbt_work_decode_mtp(const json_t *val, struct work *work) base58_decode("a1kCCGddf5pMXSipLVD9hBG2MGGVNaJ15U", script_payee); job_pack_tx(coinb5, 50000000, script_payee); + base58_decode("aChWVb8CpgajadpLmiwDZvZaKizQgHxfh5", script_payee); + job_pack_tx(coinb51, 7000000, script_payee); /* // for testnet with znode payment base58_decode("TDk19wPKYq91i18qmY6U9FeTdTxwPeSveo", script_payee); @@ -1853,6 +1856,9 @@ static bool gbt_work_decode_mtp(const json_t *val, struct work *work) hex2bin(cbtx + cbtx_size, coinb5, strlen(coinb5)); cbtx_size = cbtx_size + (int)((strlen(coinb5)) / 2); + hex2bin(cbtx + cbtx_size, coinb51, strlen(coinb51)); + cbtx_size = cbtx_size + (int)((strlen(coinb51)) / 2); + hex2bin(cbtx + cbtx_size, coinb6, strlen(coinb6)); cbtx_size = cbtx_size + (int)((strlen(coinb6)) / 2); diff --git a/compat/ccminer-config.h b/compat/ccminer-config.h index 734658f..ae8c87a 100644 --- a/compat/ccminer-config.h +++ b/compat/ccminer-config.h @@ -164,7 +164,7 @@ #define PACKAGE_URL "http://github.com/zcoinofficial/ccminer" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.2.3-djm34" +#define PACKAGE_VERSION "1.3.0-djm34" /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be diff --git a/configure.ac b/configure.ac index 46b623b..44757dc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([ccminer], [1.2.3-djm34], [], [ccminer], [http://github.com/zcoinofficial/ccminer]) +AC_INIT([ccminer], [1.3.0-djm34], [], [ccminer], [http://github.com/zcoinofficial/ccminer]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/cuda_mtp/mtp.cu b/cuda_mtp/mtp.cu index f937a99..89b410a 100644 --- a/cuda_mtp/mtp.cu +++ b/cuda_mtp/mtp.cu @@ -74,11 +74,10 @@ extern "C" int scanhash_mtp(int nthreads,int thr_id, struct work* work, uint32_t cudaSetDevice(dev_id); cudaDeviceReset(); - cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); -// cudaSetDeviceFlags(cudaDeviceScheduleYield); + cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); // cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte); - + cudaProfilerStop(); // intensity = cuda_default_throughput(thr_id, intensity); // 18=256*256*4; cudaDeviceProp props; @@ -161,10 +160,10 @@ argon2_ctx_from_mtp(&context[thr_id], &instance[thr_id]); // printf("work->data[17]=%08x\n", work->data[17]); uint32_t foundNonce; // cudaProfilerStart(); -// cudaProfilerStop(); + cudaProfilerStop(); *hashes_done = pdata[19] - first_nonce + throughput; foundNonce = mtp_cpu_hash_32(thr_id, throughput, pdata[19]); -// cudaProfilerStop(); + cudaProfilerStop(); uint32_t _ALIGN(64) vhash64[8]; if (foundNonce != UINT32_MAX) { @@ -184,6 +183,7 @@ argon2_ctx_from_mtp(&context[thr_id], &instance[thr_id]); uint32_t is_sol = mtp_solver(thr_id,foundNonce, &instance[thr_id], nBlockMTP,nProofMTP, TheMerkleRoot[thr_id], mtpHashValue, *ordered_tree[thr_id], endiandata,TheUint256Target[0]); + cudaDeviceSynchronize(); if (is_sol==1 /*&& fulltest(vhash64, ptarget)*/) { int res = 1; @@ -429,10 +429,7 @@ extern "C" int scanhash_mtp_solo(int nthreads, int thr_id, struct work* work, ui gpulog(LOG_INFO, thr_id, "%s: %.1f Kh/s nonce %08x ", device_name[device_map[thr_id]], hashrate / 1000., pdata[19]); pdata[19] += throughput; - if (pdata[19] >= real_maxnonce) { - gpulog(LOG_WARNING, thr_id, "OUT OF NONCE %x >= %x incrementing extra nonce at next chance", pdata[19], real_maxnonce); - sctx->job.IncXtra = true; - } + } while (!work_restart[thr_id].restart && pdata[19]