Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
monkins1010 authored Feb 27, 2019
1 parent d55c617 commit f3d5365
Show file tree
Hide file tree
Showing 10 changed files with 1,171 additions and 1,342 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ccminer_SOURCES = elist.h miner.h compat.h \
ccminer.cpp pools.cpp util.cpp bench.cpp \
api.cpp hashlog.cpp stats.cpp sysinfos.cpp \
equi/equi-stratum.cpp verus/verusscan.cpp verus/haraka.c verus/haraka.h \
verus/haraka_portable.c verus/verus_clhash.cpp verus/verus_clhash_portable.cpp
verus/haraka_portable.c verus/verus_clhash.cpp verus/clhash_portable.cpp



Expand Down
1,061 changes: 1,061 additions & 0 deletions avxintrin-emu.h

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions bignum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,47 @@
#endif

#include "miner.h" // hex2bin
/*
extern "C" double bn_convert_nbits(const uint32_t nBits)
{
uint256 bn = CBigNum().SetCompact(nBits).getuint256();
return bn.getdouble();
}
// copy the big number to 32-bytes uchar
extern "C" void bn_nbits_to_uchar(const uint32_t nBits, unsigned char *target)
{
char buff[65];
uint256 bn = CBigNum().SetCompact(nBits).getuint256();
snprintf(buff, 65, "%s\n", bn.ToString().c_str()); buff[64] = '\0';
hex2bin(target, buff, 32);
}
*/
// unused, but should allow more than 256bits targets
#if 0
extern "C" double bn_hash_target_ratio(uint32_t* hash, uint32_t* target)
{
double dhash;

if (!opt_showdiff)
return 0.0;

CBigNum h(0), t(0);
std::vector<unsigned char> vch(32);

memcpy(&vch[0], (void*) target, 32);
t.setvch(vch);
memcpy(&vch[0], (void*) hash, 32);
h.setvch(vch);

dhash = h.getuint256().getdouble();
if (dhash > 0.)
return t.getuint256().getdouble() / dhash;
else
return dhash;
}
#endif

// compute the diff ratio between a found hash and the target
extern "C" double bn_hash_target_ratio(uint32_t* hash, uint32_t* target)
Expand Down
8 changes: 4 additions & 4 deletions bignum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ class CBigNum
CBigNum(signed char n) { init(); if (n >= 0) setulong(n); else setint64(n); }
CBigNum(short n) { init(); if (n >= 0) setulong(n); else setint64(n); }
CBigNum(int n) { init(); if (n >= 0) setulong(n); else setint64(n); }
// CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); }
// CBigNum(int64_t n) { init(); setint64(n); }
CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); }
CBigNum(int64_t n) { init(); setint64(n); }
CBigNum(unsigned char n) { init(); setulong(n); }
CBigNum(unsigned short n) { init(); setulong(n); }
CBigNum(unsigned int n) { init(); setulong(n); }
// CBigNum(unsigned long n) { init(); setulong(n); }
// CBigNum(uint64_t n) { init(); setuint64(n); }
CBigNum(unsigned long n) { init(); setulong(n); }
CBigNum(uint64_t n) { init(); setuint64(n); }
//explicit CBigNum(uint256_t n) { init(); setuint256(n); }

explicit CBigNum(const std::vector<unsigned char>& vch)
Expand Down
26 changes: 13 additions & 13 deletions ccminer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Jeff Garzi
* Copyright 2010 Jeff Garzik
* Copyright 2012-2014 pooler
* Copyright 2014-2017 tpruvot
*
Expand Down Expand Up @@ -42,8 +42,8 @@

#include "miner.h"
#include "algos.h"
//#include "sia/sia-rpc.h"
//#include "crypto/xmr-rpc.h"
#include "sia/sia-rpc.h"
#include "crypto/xmr-rpc.h"
#include "equi/equihash.h"

//#include <cuda_runtime.h>
Expand Down Expand Up @@ -86,17 +86,17 @@ bool opt_debug_threads = false;
bool opt_protocol = false;
bool opt_benchmark = false;
bool opt_showdiff = true;
bool opt_hwmonitor = true;
bool opt_hwmonitor = false;

// todo: limit use of these flags,
// prefer the pools[] attributes
bool want_longpoll = true;
bool want_longpoll = false;
bool have_longpoll = false;
bool want_stratum = true;
bool have_stratum = false;
bool allow_gbt = true;
bool allow_mininginfo = true;
bool check_dups = true; //false;
bool check_dups = false; //false;
bool check_stratum_jobs = false;
bool opt_submit_stale = false;
bool submit_old = false;
Expand Down Expand Up @@ -905,11 +905,11 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
if (pool->type & POOL_STRATUM && stratum.is_equihash) {
struct work submit_work;
memcpy(&submit_work, work, sizeof(struct work));
if (!hashlog_already_submittted(submit_work.job_id, submit_work.nonces[idnonce])) {
//if (!hashlog_already_submittted(submit_work.job_id, submit_work.nonces[idnonce])) {
if (equi_stratum_submit(pool, &submit_work))
hashlog_remember_submit(&submit_work, submit_work.nonces[idnonce]);
stratum.job.shares_count++;
}
//}
return true;
}

Expand Down Expand Up @@ -2038,8 +2038,7 @@ static void *miner_thread(void *userdata)

} else if (opt_algo == ALGO_EQUIHASH) {
nonceptr[1]++;
//nonceptr[1] |= thr_id << 24;
nonceptr[2] |= thr_id;
nonceptr[2] |= thr_id; //try was nonceptr[1] |= thr_id << 24
//applog_hex(&work.data[27], 32);
} else if (opt_algo == ALGO_WILDKECCAK) {
//nonceptr[1] += 1;
Expand Down Expand Up @@ -3296,15 +3295,16 @@ void parse_arg(int key, char *arg)
break;
case 1080: /* --led */
{

if (!opt_led_mode)
opt_led_mode = LED_MODE_SHARES;
char *pch = strtok(arg,",");
int n = 0, lastval, val;
while (pch != NULL && n < MAX_GPUS) {
int dev_id = device_map[n++];
char * p = strstr(pch, "0x");
val = p ? (int32_t) strtoul(p, NULL, 16) : atoi(pch);
if (!val && !strcmp(pch, "mining"))
opt_led_mode = 1;
opt_led_mode = LED_MODE_MINING;
else if (device_led[dev_id] == -1)
device_led[dev_id] = lastval = val;
pch = strtok(NULL, ",");
Expand Down Expand Up @@ -3668,7 +3668,7 @@ int main(int argc, char *argv[])
if (!opt_quiet) {
const char* arch = is_x64() ? "64-bits" : "32-bits";

printf(" Built with Sweat and tears :-)" );
printf(" Built with VC++ %d" , msver());
printf(" Originally based on Christian Buchner and Christian H. project\n");
printf("BTC donation address: 1AJdfCpLWPNoAMDfHF1wD5y8VgKSSTHxPo (tpruvot)\n\n");
printf("Verus donation address: REoPcdGXthL5yeTCrJtrQv5xhYTknbFbec (monkins)\n");
Expand Down
Loading

0 comments on commit f3d5365

Please sign in to comment.