Browse Source

Revert "decred: prepare full stratum support"

This reverts commit 4e769915d8.

proper v1.7.3 for yiimp
master
Tanguy Pruvot 8 years ago
parent
commit
b0617ba0fc
  1. 41
      ccminer.cpp
  2. 8
      res/ccminer.rc

41
ccminer.cpp

@ -1344,16 +1344,9 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) @@ -1344,16 +1344,9 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
/* Generate merkle root */
switch (opt_algo) {
case ALGO_DECRED:
//applog(LOG_BLUE, "block version %x", le32dec(sctx->job.version));
if (le32dec(sctx->job.version) & 0xFF) {
// getwork over stratum
memcpy(merkle_root, sctx->job.coinbase, 32);
memcpy(extraheader, &sctx->job.coinbase[32], (int)sctx->job.coinbase_size - 32);
headersize = (int)sctx->job.coinbase_size - 32;
} else {
// future stratum with coinbase
sha256d(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size);
}
memcpy(merkle_root, sctx->job.coinbase, 32);
memcpy(extraheader, &sctx->job.coinbase[32], (int)sctx->job.coinbase_size - 32);
headersize = (int)sctx->job.coinbase_size - 32;
break;
case ALGO_HEAVY:
case ALGO_MJOLLNIR:
@ -1375,7 +1368,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) @@ -1375,7 +1368,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
memcpy(merkle_root + 32, sctx->job.merkle[i], 32);
if (opt_algo == ALGO_HEAVY || opt_algo == ALGO_MJOLLNIR)
heavycoin_hash(merkle_root, merkle_root, 64);
else if (!headersize)
else if (opt_algo != ALGO_DECRED)
sha256d(merkle_root, merkle_root, 64);
}
@ -1391,25 +1384,13 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) @@ -1391,25 +1384,13 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
work->data[9 + i] = be32dec((uint32_t *)merkle_root + i);
if (opt_algo == ALGO_DECRED) {
// all is reversed to keep same endian as ocminer getwork pool (same as ZR5)
uint32_t* extradata = (uint32_t*) sctx->xnonce1;
if (headersize) {
// getwork over stratum
for (i = 0; i < 8; i++)
work->data[1 + i] = swab32(work->data[1 + i]);
for (i = 0; i < 8; i++)
work->data[9 + i] = swab32(work->data[9 + i]);
for (i = 0; i < headersize/4; i++)
work->data[17 + i] = le32dec((uint32_t*)extraheader + i);
} else {
work->data[0] = swab32(work->data[0]);
for (i = 0; i < 8; i++)
work->data[9 + i] = swab32(work->data[9 + i]);
// todo work->data[17..33], but how ? :p
work->data[29] = be32dec(sctx->job.nbits);
work->data[32] = sctx->job.height;
work->data[34] = be32dec(sctx->job.ntime);
}
for (i = 0; i < 8; i++)
work->data[1 + i] = swab32(work->data[1 + i]);
for (i = 0; i < 8; i++)
work->data[9 + i] = swab32(work->data[9 + i]);
for (i = 0; i < headersize/4; i++)
work->data[17 + i] = le32dec((uint32_t*)extraheader + i);
for (i = 0; i < sctx->xnonce1_size/4; i++)
work->data[36 + i] = extradata[i];
work->data[37] = (rand()*4) << 8;
@ -1417,7 +1398,6 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) @@ -1417,7 +1398,6 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
work->data[i] = 0;
sctx->job.height = work->data[32];
//applog_hex(work->data, 180);
//applog_hex(&work->data[17], 64);
} else {
work->data[17] = le32dec(sctx->job.ntime);
work->data[18] = le32dec(sctx->job.nbits);
@ -3281,6 +3261,7 @@ int main(int argc, char *argv[]) @@ -3281,6 +3261,7 @@ int main(int argc, char *argv[])
if (opt_algo == ALGO_DECRED) {
allow_gbt = false;
allow_mininginfo = false;
}
flags = !opt_benchmark && strncmp(rpc_url, "https:", 6)

8
res/ccminer.rc

@ -60,8 +60,8 @@ IDI_ICON1 ICON "ccminer.ico" @@ -60,8 +60,8 @@ IDI_ICON1 ICON "ccminer.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,2,0
PRODUCTVERSION 1,7,2,0
FILEVERSION 1,7,3,0
PRODUCTVERSION 1,7,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x21L
@ -76,10 +76,10 @@ BEGIN @@ -76,10 +76,10 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "FileVersion", "1.7.2"
VALUE "FileVersion", "1.7.3"
VALUE "LegalCopyright", "Copyright (C) 2016"
VALUE "ProductName", "ccminer"
VALUE "ProductVersion", "1.7.2"
VALUE "ProductVersion", "1.7.3"
END
END
BLOCK "VarFileInfo"

Loading…
Cancel
Save