Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port ckolivas #419

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Version 4.2.0 - TBA

* Forward-port changes from `ckolivas/cgminer` up to 3.12.1.
* Forward-port changes from `ckolivas/cgminer` up to 3.12.3, and then some
(up to 133252175b90159d18151b004bf767d5a43812ea).


## Version 4.1.0 - 7th February 2014
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,30 @@ For example (this is wrapped, but it's all on one line for real):
000000004a4366808f81d44f26df3d69d7dc4b3473385930462d9ab707b50498
f681634a4f1f63d01a0cd43fb338000000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000080020000


## Benchmark

The --benchmark option hashes a single fixed work item over and over and does
not submit shares to any pools.

The --benchfile <arg> option hashes the work given in the file <arg> supplied.
The format of the work file is:
version,merkleroot,prevhash,diffbits,noncetime
Any empty line or any line starting with '#' or '/' is ignored.
When it reaches the end of the file it continues back at the top.

The format of the data items matches the byte ordering and format of the
the bitcoind getblock RPC output.

An example file containing bitcoin block #1 would be:

# Block 1
1,0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098,00000000001
9d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f,1d00ffff,1231469665

However, the work data should be one line without the linebreak in the middle

If you use --benchfile <arg>, then --benchfile-display will output a log line,
for each nonce found, showing the nonce value in decimal and hex and the work
used to find it in hex.
2 changes: 1 addition & 1 deletion api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3737,7 +3737,7 @@ void api(int api_thr_id)
json_t *json_config = NULL;
json_t *json_val;
bool isjson;
bool did, isjoin, firstjoin;
bool did, isjoin = false, firstjoin;
int i;

SOCKETTYPE *apisock;
Expand Down
5 changes: 5 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ bs_dir="$(dirname $(readlink -f $0))"
#Some versions of libtoolize don't like there being no ltmain.sh file already
touch "${bs_dir}"/ltmain.sh
autoreconf -fi "${bs_dir}"

if test -n "$1" && test -z "$NOCONFIGURE" ; then
echo 'Configuring...'
"$bs_dir"/configure "$@"
fi
33 changes: 31 additions & 2 deletions doc/API
Original file line number Diff line number Diff line change
Expand Up @@ -1270,20 +1270,49 @@ However, if $readonly is true, it will not display them

---------

Default:
$rigport = 4028;

Default port to use if any $rigs entries don't specify the port number

---------

Default:
$rigs = array('127.0.0.1:4028');

Set $rigs to an array of your sgminer rigs that are running
format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name'
Set $rigs to an array of your rigs that are running
format: 'IP' or 'Host' or 'IP:Port' or 'Host:Port' or 'Host:Port:Name'
If you only have one rig, it will just show the detail of that rig
If you have more than one rig it will show a summary of all the rigs
with buttons to show the details of each rig -
the button contents will be 'Name' rather than rig number, if you
specify 'Name'
If Port is missing or blank, it will try $rigport
e.g. $rigs = array('127.0.0.1:4028','myrig.com:4028:Sugoi');

---------

Default:
$rignames = false;

Set $rignames to false to not affect the display.
Set $rignames to one of 'ip' or 'ipx' to alter the name displayed
if the rig doesn't have a 'name' in $rigs
Currently:
'ip' means use the 4th byte of the rig IP address as an integer
'ipx' means use the 4th byte of the rig IP address as 2 hex bytes

---------

Default:
$rigbuttons = true;

Set $rigbuttons to false to display a link rather than a button on
the left of any summary table with rig buttons, in order to reduce
the height of the table cells

---------

Default:
$mcast = false;

Expand Down
20 changes: 20 additions & 0 deletions logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,23 @@ void _applog(int prio, const char *str, bool force)
my_log_curses(prio, datetime, str, force);
}
}

void _simplelog(int prio, const char *str, bool force)
{
#ifdef HAVE_SYSLOG_H
if (use_syslog) {
syslog(prio, "%s", str);
}
#else
if (0) {}
#endif
else {
/* Only output to stderr if it's not going to the screen as well */
if (!isatty(fileno((FILE *)stderr))) {
fprintf(stderr, "%s\n", str); /* atomic write to stderr */
fflush(stderr);
}

my_log_curses(prio, "", str, force);
}
}
11 changes: 11 additions & 0 deletions logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern int opt_log_show_date;
#define LOGBUFSIZ 256

extern void _applog(int prio, const char *str, bool force);
extern void _simplelog(int prio, const char *str, bool force);

#define IN_FMT_FFL " in %s %s():%d"

Expand All @@ -44,6 +45,16 @@ extern void _applog(int prio, const char *str, bool force);
} \
} while (0)

#define simplelog(prio, fmt, ...) do { \
if (opt_debug || prio != LOG_DEBUG) { \
if (use_syslog || opt_log_output || prio <= opt_log_level) { \
char tmp42[LOGBUFSIZ]; \
snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \
_simplelog(prio, tmp42, false); \
} \
} \
} while (0)

#define applogsiz(prio, _SIZ, fmt, ...) do { \
if (opt_debug || prio != LOG_DEBUG) { \
if (use_syslog || opt_log_output || prio <= opt_log_level) { \
Expand Down
2 changes: 2 additions & 0 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ static inline int fsync (int fd)
#ifndef htobe32
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define htole16(x) (x)
# define le16toh(x) (x)
# define htole32(x) (x)
# define htole64(x) (x)
# define le32toh(x) (x)
Expand All @@ -169,6 +170,7 @@ static inline int fsync (int fd)
# define htobe64(x) bswap_64(x)
# elif __BYTE_ORDER == __BIG_ENDIAN
# define htole16(x) bswap_16(x)
# define le16toh(x) bswap_16(x)
# define htole32(x) bswap_32(x)
# define le32toh(x) bswap_32(x)
# define le64toh(x) bswap_64(x)
Expand Down
Loading