diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..877bcf56d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +# Keeps the release build context small and reproducible. Notably drops .git +# (~23 MB) and any tarballs produced by a previous run. +.git +.gitignore +dist +*.tar.gz +*.tar.gz.sha256 diff --git a/.github/docker/Dockerfile.release b/.github/docker/Dockerfile.release new file mode 100644 index 0000000000..0fbeeb0ef0 --- /dev/null +++ b/.github/docker/Dockerfile.release @@ -0,0 +1,53 @@ +# Release build for cgminer-htr. +# +# Built on Debian bullseye (glibc 2.31) on purpose: glibc is forward- but not +# backward-compatible, so a binary linked here runs on Raspberry Pi OS Bullseye +# and every newer release. Building on the GitHub runner's own Ubuntu 24.04 +# (glibc 2.39) would produce a binary that fails to start on Bookworm. +# +# libjansson-dev is deliberately NOT installed: configure then falls back to the +# bundled compat/jansson-2.9 and links it statically, which is one less runtime +# dependency on the miner host. + +FROM debian:bullseye AS build + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + autoconf \ + automake \ + libtool \ + pkg-config \ + libcurl4-openssl-dev \ + libusb-1.0-0-dev \ + libncurses-dev \ + zlib1g-dev \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /src +COPY . /src + +# -fcommon is required on GCC 10+ (Bullseye ships GCC 10, Bookworm GCC 12). +# This tree predates -fno-common becoming the default and otherwise fails to +# link with "multiple definition of 'bab_drv'" and friends. Pre-existing +# upstream issue, not specific to this fork's changes. +RUN ./autogen.sh > /tmp/autogen.log 2>&1 || (tail -40 /tmp/autogen.log; exit 1) +RUN ./configure --enable-gekko CFLAGS="-O2 -fcommon" > /tmp/configure.log 2>&1 \ + || (tail -40 /tmp/configure.log; exit 1) +RUN make -j"$(nproc)" > /tmp/make.log 2>&1 || (tail -60 /tmp/make.log; exit 1) +RUN strip cgminer + +COPY .github/docker/smoke-test.sh /usr/local/bin/smoke-test.sh +RUN /usr/local/bin/smoke-test.sh /src/cgminer + +# Stage the payload so the export stage is a flat, predictable layout. +RUN set -eux; \ + mkdir -p /out; \ + cp /src/cgminer /out/cgminer; \ + cp /src/README /out/README; \ + cp /src/ASIC-README /out/ASIC-README 2>/dev/null || true; \ + objdump -p /out/cgminer | awk '/NEEDED/ {print $2}' > /out/RUNTIME-DEPS.txt; \ + cat /out/RUNTIME-DEPS.txt + +FROM scratch AS artifact +COPY --from=build /out/ / diff --git a/.github/docker/INSTALL.txt b/.github/docker/INSTALL.txt new file mode 100644 index 0000000000..84d150b02c --- /dev/null +++ b/.github/docker/INSTALL.txt @@ -0,0 +1,108 @@ +cgminer-htr - prebuilt binary +============================= + +This is a build of HathorNetwork/cgminer with --gekko-ticket-diff, the option +that lets a GekkoScience device answer Hathor transaction jobs instead of only +block jobs. See the README section "GEKKO TICKET DIFFICULTY" for what it does. + + +1. PICK THE RIGHT TARBALL +------------------------- + +Run this on the machine that has the miner plugged in: + + uname -m + + aarch64 -> use the linux-arm64 tarball (Raspberry Pi OS 64-bit) + armv7l -> use the linux-armhf tarball (Raspberry Pi OS 32-bit) + x86_64 -> use the linux-amd64 tarball (normal PC or server) + +If you download the wrong one, it will not start and will say +"cannot execute binary file" or "Exec format error". No harm done - just get +the other one. + + +2. CHECK YOU HAVE THE LIBRARIES +------------------------------- + +The binary is dynamically linked. RUNTIME-DEPS.txt lists exactly what it needs. +On Raspberry Pi OS / Debian / Ubuntu these are almost always already installed; +if not: + + sudo apt-get install libcurl4 libusb-1.0-0 libncurses6 + +You do NOT need any -dev packages, and you do not need a compiler. + +The JSON library (jansson) is compiled into the binary, so it is not a +dependency you have to install. + +This binary is built on Debian Bullseye. glibc is forward-compatible but not +backward-compatible, so it runs on Bullseye and anything newer (Bookworm, +Trixie), but NOT on anything older. + + +3. INSTALL IT +------------- + +Stop the miner first, so the USB device is free: + + sudo systemctl stop cgminer # or whatever your service is called + +Keep the old binary so you can go back: + + sudo cp /usr/local/bin/cgminer /usr/local/bin/cgminer.bak + +Put the new one in place (adjust the path if yours lives somewhere else - +`which cgminer` will tell you): + + sudo install -m 755 ./cgminer /usr/local/bin/cgminer + +Start it again: + + sudo systemctl start cgminer + +Your udev rules, USB group membership, and service file are untouched. + + +4. CONFIRM IT WORKED +-------------------- + +The option defaults to 1, so you do not have to change your command line or +your .conf file. In the log you should now see: + + set ticket to 0x00/1 + +instead of the old value (0xf0/16 on a BM1397 board such as the Compac F). + +Two things to watch in the first hour: + + - Transaction shares. This is the whole point: the device should start + getting accepted transaction jobs, not only block jobs. + - The string "PT_NONONCE" in the log. A lower ticket means the driver + expects nonces more often, so its stall watchdog window gets shorter. If + you see PT_NONONCE and the frequency resetting, please report it - that is + the one known risk of this change and we want to know. + +To go back at any time: + + sudo systemctl stop cgminer + sudo cp /usr/local/bin/cgminer.bak /usr/local/bin/cgminer + sudo systemctl start cgminer + +Or keep this binary and turn the change off with --gekko-ticket-diff 0, which +restores the original upstream behaviour. + + +5. IF YOU PREFER TO BUILD IT YOURSELF +------------------------------------- + + sudo apt-get install build-essential autoconf automake libtool pkg-config \ + libcurl4-openssl-dev libusb-1.0-0-dev libncurses-dev zlib1g-dev + ./autogen.sh + ./configure --enable-gekko CFLAGS="-O2 -fcommon" + make + +-fcommon is required on GCC 10 and newer, which includes every current +Raspberry Pi OS. Without it the link fails with "multiple definition of +'bab_drv'". This is a pre-existing upstream issue, not something this fork +introduced. diff --git a/.github/docker/smoke-test.sh b/.github/docker/smoke-test.sh new file mode 100755 index 0000000000..fdc84998f1 --- /dev/null +++ b/.github/docker/smoke-test.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Smoke tests run inside the release build, against the freshly built binary. +# These are cheap and they guard against shipping a binary that is broken in a +# way `make` cannot see. The config-save test in particular is a regression test +# for a SIGSEGV that got all the way to review: write_config() dispatches on the +# option's callback pointer, so a new setter that is not registered there is +# type-punned and passed to strlen(). It crashed on default settings, on every +# gekko build, whether or not the new flag was used. +set -euo pipefail + +CGMINER="${1:?usage: smoke-test.sh /path/to/cgminer}" +API_PORT=4028 +CONF=/tmp/smoke-out.conf + +fail() { echo "SMOKE FAIL: $*" >&2; exit 1; } +pass() { echo " ok $*"; } + +echo "== 1. binary runs and reports a version" +"$CGMINER" --version || fail "--version exited non-zero" +pass "--version" + +echo "== 2. --gekko-ticket-diff is registered with the documented default" +HELP="$("$CGMINER" --help 2>&1 || true)" +grep -q -- '--gekko-ticket-diff' <<<"$HELP" || fail "--gekko-ticket-diff missing from --help" +grep -A2 -- '--gekko-ticket-diff' <<<"$HELP" | grep -qi 'default: 1' \ + || fail "--gekko-ticket-diff default is not 1" +pass "--gekko-ticket-diff present, default 1" + +echo "== 3. argument validation" +for good in 0 1 16 64; do + "$CGMINER" --gekko-ticket-diff "$good" --version >/dev/null 2>&1 \ + || fail "valid ticket-diff $good was rejected" +done +pass "accepts 0 1 16 64" +for bad in 0.5 100 -1 nan; do + if "$CGMINER" --gekko-ticket-diff "$bad" --version >/dev/null 2>&1; then + fail "invalid ticket-diff $bad was accepted" + fi +done +pass "rejects 0.5 100 -1 nan" + +echo "== 4. config save does not crash (regression: write_config type-pun SIGSEGV)" +rm -f "$CONF" +"$CGMINER" --benchmark -T \ + --api-listen --api-allow "W:127.0.0.1" --api-port "$API_PORT" \ + > /tmp/smoke-cgminer.log 2>&1 & +CGPID=$! +trap 'kill -9 "$CGPID" 2>/dev/null || true' EXIT + +# QEMU-emulated startup is slow; poll rather than sleeping a fixed amount. +for _ in $(seq 1 60); do + if (exec 3<>/dev/tcp/127.0.0.1/"$API_PORT") 2>/dev/null; then + exec 3<&- 3>&- + break + fi + sleep 1 +done + +kill -0 "$CGPID" 2>/dev/null || fail "cgminer died before the API came up" + +exec 3<>/dev/tcp/127.0.0.1/"$API_PORT" || fail "could not reach the API" +printf 'save|%s' "$CONF" >&3 +API_REPLY="$(timeout 30 cat <&3 || true)" +exec 3<&- 3>&- || true + +sleep 2 +kill -0 "$CGPID" 2>/dev/null || fail "cgminer CRASHED on config save -- reply was: ${API_REPLY:-}" +grep -q 'STATUS=S' <<<"$API_REPLY" || fail "config save reported failure: ${API_REPLY:-}" +[ -s "$CONF" ] || fail "config save wrote no bytes" +grep -q 'gekko-ticket-diff' "$CONF" || fail "gekko-ticket-diff missing from the saved config" +pass "config save: $(wc -c < "$CONF") bytes, $(grep -o '"gekko-ticket-diff" : "[^"]*"' "$CONF")" + +kill "$CGPID" 2>/dev/null || true +trap - EXIT +echo "SMOKE OK" diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000000..b2065e2e59 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,128 @@ +name: Build release binaries + +# Produces ready-to-run cgminer binaries for the Hathor mining fleet, so an +# operator can drop in a new build instead of installing a toolchain and +# compiling on a Raspberry Pi. +# +# Push a tag (v1.2.3) to cut a release, or run it manually from the Actions tab +# to get throwaway artifacts without publishing anything. Pull requests build +# and smoke-test but publish nothing. + +on: + push: + tags: + - 'v*' + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: ${{ matrix.arch }} + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + # Raspberry Pi OS 64-bit -> `uname -m` reports aarch64. + # Built natively on GitHub's ARM runners (free for public repos), so + # the smoke tests execute on real ARM hardware rather than under QEMU. + - arch: arm64 + platform: linux/arm64 + runner: ubuntu-24.04-arm + qemu: false + # Raspberry Pi OS 32-bit -> `uname -m` reports armv7l. + # Needs QEMU: GitHub's ARM runners are Cobalt/Ampere cores, which do + # not support 32-bit execution, so this cannot be built natively here. + - arch: armhf + platform: linux/arm/v7 + runner: ubuntu-24.04 + qemu: true + # Not for the fleet - lets a maintainer reproduce a shipped binary on + # a normal dev machine. + - arch: amd64 + platform: linux/amd64 + runner: ubuntu-24.04 + qemu: false + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + if: matrix.qemu + uses: docker/setup-qemu-action@v3 + + - uses: docker/setup-buildx-action@v3 + + - name: Build and smoke-test + run: | + docker buildx build \ + --platform "${{ matrix.platform }}" \ + --file .github/docker/Dockerfile.release \ + --target artifact \ + --progress plain \ + --output "type=local,dest=dist/${{ matrix.arch }}" \ + . + + - name: Package + id: package + run: | + set -euo pipefail + if [ "${GITHUB_REF_TYPE}" = "tag" ]; then + VERSION="${GITHUB_REF_NAME}" + else + VERSION="$(git describe --tags --always --dirty 2>/dev/null || git rev-parse --short HEAD)" + fi + NAME="cgminer-htr-${VERSION}-linux-${{ matrix.arch }}" + mv "dist/${{ matrix.arch }}" "dist/${NAME}" + cp .github/docker/INSTALL.txt "dist/${NAME}/INSTALL.txt" + tar -C dist -czf "${NAME}.tar.gz" "${NAME}" + sha256sum "${NAME}.tar.gz" > "${NAME}.tar.gz.sha256" + echo "name=${NAME}" >> "$GITHUB_OUTPUT" + echo "--- shipped ---" + ls -l "dist/${NAME}" + echo "--- runtime deps ---" + cat "dist/${NAME}/RUNTIME-DEPS.txt" + + - uses: actions/upload-artifact@v4 + with: + name: ${{ steps.package.outputs.name }} + path: | + *.tar.gz + *.tar.gz.sha256 + if-no-files-found: error + + release: + name: Publish release + needs: build + if: github.ref_type == 'tag' + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + path: artifacts + merge-multiple: true + + - name: Publish + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + ls -l artifacts + if gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then + gh release upload "${GITHUB_REF_NAME}" \ + --repo "${GITHUB_REPOSITORY}" \ + --clobber \ + artifacts/* + else + gh release create "${GITHUB_REF_NAME}" \ + --repo "${GITHUB_REPOSITORY}" \ + --title "${GITHUB_REF_NAME}" \ + --generate-notes \ + --verify-tag \ + artifacts/* + fi diff --git a/README b/README index e74c9d9be4..d4536723e4 100644 --- a/README +++ b/README @@ -11,6 +11,74 @@ This code is licensed under the GPLv3. This means that the source to any modifications you make to this code MUST be provided by law if you distribute modified binaries. See COPYING for details. + +HATHOR FORK NOTES +----------------- + +This fork exists to mine Hathor transactions via tx-mining-service, which +differs from Bitcoin pool mining in one way that matters for hardware setup: +jobs arrive at weight 17-32, i.e. difficulties far BELOW 1, and each job lives +only tens of milliseconds before another miner solves it. + +--gekko-ticket-diff <1-64, or 0> (default: 1) + + Ticket difficulty requested from BM1397 (Compac F) and BM1362 chips. + + The ticket is the floor below which the ASIC reports no nonce at all. Stock + cgminer always asks for the highest ticket the chip supports - 16 on a single + Compac F - because a Bitcoin pool's difficulty is always well above it. For + Hathor that assumption is wrong: a chip at ticket 16 cannot report anything + below weight 36. Such a nonce over-satisfies a weight-17 tx, so the chip can + still answer one in principle - but only after it finds weight-36 work, which + takes ticket * 2^32 / hashrate. At any hashrate these sticks actually reach + that is far longer than a tx lives, so in practice it answers nothing. + + Measured on mainnet: a 75.8 GH/s Compac F at ticket 16 takes ~906 ms to report + anything, against a median tx lifetime of 54 ms - it solved 0 of 133 txs over + 48 hours. At ticket 1 the same device reports in ~57 ms. + + Leave this at the default of 1 for Hathor mining. Set it to 0 to restore the + stock behaviour (chip maximum) if you point this build at a Bitcoin pool. + + BM1384 (2Pac, Terminus) and BM1387 (NewPac) chips do not use this setting; + their ticket is derived from hashrate instead. That lands at 1 only on slower + sticks - a 2Pac at ~5 GH/s gets difficulty 1, but around 10 GH/s it becomes 2 + and around 20 GH/s it becomes 4, so a well-tuned 2Pac carries a reporting + floor too. Lowering it there would need a separate change to that formula. + +Building on a modern toolchain + + GCC 10 and newer default to -fno-common, which this codebase predates. Without + the flag below the link fails with "multiple definition of `xxx_drv'" for every + driver. This affects the unmodified upstream tree too, not just this fork: + + ./autogen.sh --enable-gekko CFLAGS="-O2 -fcommon" + make + + Verified on Ubuntu 22.04 with the dependency list under "If building on Ubuntu" + below. + +Prebuilt binaries + + You do not have to build this yourself. Every tagged release publishes ready + to run binaries on the Releases page, for linux-arm64 (Raspberry Pi OS 64-bit, + `uname -m` says aarch64), linux-armhf (Raspberry Pi OS 32-bit, armv7l) and + linux-amd64. + + One binary per architecture covers every GekkoScience model. All of them live + in the same driver and are selected at runtime from the USB vendor/product id, + and the --gekko-*-detect options are opt-in allowlists that all default to off, + so an unrestricted build detects the 2Pac, the NewPac and the Compac F alike. + Everything that differs per device - frequency, core voltage, ticket + difficulty - is runtime configuration, not a build-time choice. + + They are built on Debian Bullseye, so they run on Bullseye and anything newer. + Each tarball carries an INSTALL.txt with the swap-and-restart steps and a + RUNTIME-DEPS.txt listing the shared libraries needed. The workflow that builds + them is .github/workflows/build-release.yml; it smoke-tests every binary + before publishing. + + Search below for the following headings for details about mining EXECUTIVE SUMMARY ON USAGE diff --git a/cgminer.c b/cgminer.c index dcea7f16d9..473c3e602f 100644 --- a/cgminer.c +++ b/cgminer.c @@ -351,6 +351,11 @@ bool opt_gekko_mine2 = false; // gekko code ignores it int opt_gekko_tune2 = 0; int opt_gekko_gsa1_start_freq = 300; int opt_gekko_gsa1_corev = 300; // 0x3c +// Ticket difficulty requested from BM1397/BM1362 chips. 0 = the chip's highest +// valid ticket (upstream behaviour). Defaults to 1 because this fork mines +// Hathor, whose tx jobs arrive at weight 17-32 and cannot be answered by a chip +// whose reporting floor sits at the maximum ticket. See driver-gekko.c. +float opt_gekko_ticket_diff = 1.0; #endif #ifdef USE_HASHRATIO #include "driver-hashratio.h" @@ -1354,6 +1359,31 @@ static char *set_float_0_to_500(const char *arg, float *i) return NULL; } +#ifdef USE_GEKKO +static char *set_float_ticket_diff(const char *arg, float *i) +{ + char *err = opt_set_floatval(arg, i); + + if (err) + return err; + + // Reject NaN explicitly: every comparison against NaN is false, so it would + // slip past the range test below and reach set_ticket(), where floor(NaN) + // matches no ticket_1397[] entry and leaves the device's ticket unset. + if (isnan(*i)) + return "Value must be a number"; + + // 0 means "let the chip pick the highest ticket it supports". Above 0 the + // value must be at least 1: set_ticket() floors it and the lowest + // ticket_1397[] entry is diff 1, so anything in (0,1) would match no entry + // and silently leave the ticket unset. 64 is the largest entry in the table. + if (*i != 0 && (*i < 1 || *i > 64)) + return "Value out of range - use 0 for the chip maximum, or 1 to 64"; + + return NULL; +} +#endif + static char *set_float_125_to_500(const char *arg, float *i) { char *err = opt_set_floatval(arg, i); @@ -2049,6 +2079,9 @@ static struct opt_table opt_config_table[] = { OPT_WITH_ARG("--gekko-tune2", set_int_0_to_9999, opt_show_intval, &opt_gekko_tune2, "Tune up mine2 mins 30-9999, default 0=never"), + OPT_WITH_ARG("--gekko-ticket-diff", + set_float_ticket_diff, opt_show_floatval, &opt_gekko_ticket_diff, + "Set GekkoScience BM1397/BM1362 ticket difficulty 1-64, 0=chip maximum, default 1 (lowest reporting floor, needed for Hathor tx mining)"), OPT_WITH_ARG("--gekko-compaca1-start-freq", set_int_0_to_9999, opt_show_intval, &opt_gekko_gsa1_start_freq, "Ramp CompacA1 start frequency MHz 100-800"), @@ -6031,6 +6064,9 @@ void write_config(FILE *fcfg) if (opt->type & OPT_HASARG && ((void *)opt->cb_arg == (void *)set_float_0_to_500 || +#ifdef USE_GEKKO + (void *)opt->cb_arg == (void *)set_float_ticket_diff || +#endif (void *)opt->cb_arg == (void *)set_float_125_to_500 || (void *)opt->cb_arg == (void *)set_float_100_to_250)) { fprintf(fcfg, ",\n\"%s\" : \"%.1f\"", p+2, *(float *)opt->u.arg); diff --git a/driver-gekko.c b/driver-gekko.c index 8524352c7f..a8307ccf52 100644 --- a/driver-gekko.c +++ b/driver-gekko.c @@ -1074,6 +1074,30 @@ struct TICKET_INFO // ticket restart checks allowed before forced to diff=1 #define MAX_TICKET_CHECK 3 +// The ticket difficulty requested from the chip is opt_gekko_ticket_diff, +// set with --gekko-ticket-diff (default 1, 0 = the chip's highest valid). +// +// Upstream always passed 0.0 here, on the assumption stated at the call sites: +// "pool will be above this anyway". That holds for Bitcoin pools; it does NOT +// hold for Hathor tx mining, where jobs arrive at weight 17-32 - difficulties +// far below 1. The ticket is the floor below which the chip reports nothing, so +// a chip at the GSF/Compac F maximum of 16 cannot report a nonce below weight +// 36. That nonce would over-satisfy a weight-17 tx, so the chip can answer one +// in principle - but only once it finds weight-36 work, which takes +// ticket * 2^32 / hashrate. At any hashrate these sticks reach, that is far +// longer than a tx lives, so in practice it answers nothing. +// +// Measured in production: a 75.8 GH/s Compac F at ticket 16 needs +// 16 * 2^32 / 75.8e9 = ~906 ms to report anything, against a median tx lifetime +// of 54 ms; it solved 0 of 133 txs over 48 h. At ticket 1 the same device +// reports in ~57 ms. +// +// The diff-1 row of ticket_1397[] validates cleanly: hi_limit 0.0 means no +// spurious "ticket too low" failures, and low_limit 1.9 is reached within the +// 50-nonce count almost immediately. +// +// See HathorNetwork/ops-tools#1415 and #1426. + // ticket values, diff descending. List values rather than calc them // end comments are how long at given task/sec (15 ~= 60 1diff nonce/sec = ~260GH/s) // testing should take and chance of failure @@ -1515,8 +1539,10 @@ static void compac_send_chain_inactive(struct cgpu_info *compac) compac_send2(compac, init4, sizeof(init4), 8 * sizeof(init4) - 8, "init4"); gekko_usleep(info, MS2US(100)); - // set ticket based on chips, pool will be above this anyway - set_ticket(compac, 0.0, true, false); + // set the ticket per --gekko-ticket-diff so Hathor tx jobs (weight 17-32) can be answered + // NB: upstream hardcoded 0.0 here ("highest valid") assuming the pool would always + // be above it - untrue for tx mining. See the ticket_1397 comment above. + set_ticket(compac, opt_gekko_ticket_diff, true, false); unsigned char init5[] = {0x51, 0x09, 0x00, 0x68, 0xC0, 0x70, 0x01, 0x11, 0x00}; unsigned char init6[] = {0x51, 0x09, 0x00, 0x28, 0x06, 0x00, 0x00, 0x0F, 0x00}; @@ -1579,8 +1605,10 @@ static void compac_send_chain_inactive(struct cgpu_info *compac) compac_send2(compac, init4, sizeof(init4), 8 * sizeof(init4) - 8, "init4"); gekko_usleep(info, MS2US(100)); - // set ticket based on chips, pool will be above this anyway - set_ticket(compac, 0.0, true, false); + // set the ticket per --gekko-ticket-diff so Hathor tx jobs (weight 17-32) can be answered + // NB: upstream hardcoded 0.0 here ("highest valid") assuming the pool would always + // be above it - untrue for tx mining. See the ticket_1397 comment above. + set_ticket(compac, opt_gekko_ticket_diff, true, false); unsigned char init5[] = {0x51, 0x09, 0x00, 0x54, 0x00, 0x00, 0x00, 0x03, 0x00}; unsigned char init6[] = {0x51, 0x09, 0x00, 0x58, 0x00, 0x01, 0x11, 0x11, 0x00}; @@ -2278,7 +2306,7 @@ static void compac_gsf_nonce(struct cgpu_info *compac, K_ITEM *item) applog(LOG_ERR, "%d: %s %d - ticket %u failed too many times setting to max", compac->cgminer_id, compac->drv->name, compac->device_id, ticket_1397[i].diff); //set_ticket(compac, 1.0, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_ok = true; break; } @@ -2289,7 +2317,7 @@ static void compac_gsf_nonce(struct cgpu_info *compac, K_ITEM *item) // try again ... //set_ticket(compac, ticket_1397[i].diff, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_failures++; break; } @@ -2321,7 +2349,7 @@ static void compac_gsf_nonce(struct cgpu_info *compac, K_ITEM *item) compac->cgminer_id, compac->drv->name, compac->device_id, ticket_1397[i].diff); //set_ticket(compac, 1.0, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_ok = true; break; } @@ -2332,7 +2360,7 @@ static void compac_gsf_nonce(struct cgpu_info *compac, K_ITEM *item) // try again ... //set_ticket(compac, ticket_1397[i].diff, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_failures++; break; } @@ -2533,7 +2561,7 @@ static void compac_gsa1_nonce(struct cgpu_info *compac, K_ITEM *item) applog(LOG_ERR, "%d: %s %d - ticket %u failed too many times setting to max", compac->cgminer_id, compac->drv->name, compac->device_id, ticket_1397[i].diff); //set_ticket(compac, 1.0, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_ok = true; break; } @@ -2544,7 +2572,7 @@ static void compac_gsa1_nonce(struct cgpu_info *compac, K_ITEM *item) // try again ... //set_ticket(compac, ticket_1397[i].diff, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_failures++; break; } @@ -2576,7 +2604,7 @@ static void compac_gsa1_nonce(struct cgpu_info *compac, K_ITEM *item) compac->cgminer_id, compac->drv->name, compac->device_id, ticket_1397[i].diff); //set_ticket(compac, 1.0, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_ok = true; break; } @@ -2587,7 +2615,7 @@ static void compac_gsa1_nonce(struct cgpu_info *compac, K_ITEM *item) // try again ... //set_ticket(compac, ticket_1397[i].diff, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_failures++; break; } @@ -2798,7 +2826,7 @@ applog(LOG_ERR, "DBG submit would be: N:'%s' BV:'%s' work=%02x %02x %02x %02x", applog(LOG_ERR, "%d: %s %d - ticket %u failed too many times setting to max", compac->cgminer_id, compac->drv->name, compac->device_id, ticket_1397[i].diff); //set_ticket(compac, 1.0, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_ok = true; break; } @@ -2809,7 +2837,7 @@ applog(LOG_ERR, "DBG submit would be: N:'%s' BV:'%s' work=%02x %02x %02x %02x", // try again ... //set_ticket(compac, ticket_1397[i].diff, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_failures++; break; } @@ -2841,7 +2869,7 @@ applog(LOG_ERR, "DBG submit would be: N:'%s' BV:'%s' work=%02x %02x %02x %02x", compac->cgminer_id, compac->drv->name, compac->device_id, ticket_1397[i].diff); //set_ticket(compac, 1.0, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_ok = true; break; } @@ -2852,7 +2880,7 @@ applog(LOG_ERR, "DBG submit would be: N:'%s' BV:'%s' work=%02x %02x %02x %02x", // try again ... //set_ticket(compac, ticket_1397[i].diff, true, true); - set_ticket(compac, 0.0, true, true); + set_ticket(compac, opt_gekko_ticket_diff, true, true); info->ticket_failures++; break; } diff --git a/miner.h b/miner.h index 4ce029b784..46f62efa26 100644 --- a/miner.h +++ b/miner.h @@ -1097,6 +1097,7 @@ extern int opt_gekko_step_delay; extern int opt_gekko_tune2; extern int opt_gekko_gsa1_start_freq; extern int opt_gekko_gsa1_corev; +extern float opt_gekko_ticket_diff; #endif #ifdef USE_KLONDIKE extern char *opt_klondike_options;