Skip to content

Commit

Permalink
fix solo mining
Browse files Browse the repository at this point in the history
  • Loading branch information
djm34 committed Oct 25, 2019
1 parent e6053ea commit 5e64697
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
10 changes: 8 additions & 2 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
Expand All @@ -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);
Expand All @@ -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];
Expand All @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion compat/ccminer-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 6 additions & 9 deletions cuda_mtp/mtp.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down Expand Up @@ -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]<real_maxnonce /*&& pdata[19]<(first_nonce+128*throughput)*/);

TheEnd:
Expand Down

0 comments on commit 5e64697

Please sign in to comment.