Browse Source

ckdb - start a new shift on a halving

master
kanoi 8 years ago
parent
commit
d3e5bb2ce0
  1. 17
      src/ckdb.c
  2. 2
      src/ckdb.h

17
src/ckdb.c

@ -4235,6 +4235,8 @@ ASSERT4((sizeof(shift_words) == (sizeof(char *) * SHIFT_WORDS)));
// optioncontrol name to override the SHIFT_DIFF_BLOCK value // optioncontrol name to override the SHIFT_DIFF_BLOCK value
#define SHIFT_DIFF_BLOCK_STR "ShiftDiffBlock" #define SHIFT_DIFF_BLOCK_STR "ShiftDiffBlock"
#define BLOCK_HALVING 210000
static void make_a_shift_mark() static void make_a_shift_mark()
{ {
K_TREE_CTX ss_ctx[1], m_ctx[1], wi_ctx[1], b_ctx[1]; K_TREE_CTX ss_ctx[1], m_ctx[1], wi_ctx[1], b_ctx[1];
@ -4499,7 +4501,7 @@ static void make_a_shift_mark()
* changed */ * changed */
if (strcmp(wi_bits, workinfo->bits) != 0) { if (strcmp(wi_bits, workinfo->bits) != 0) {
if (workinfo->height > (int32_t)shiftdiffblock) { if (workinfo->height > (int32_t)shiftdiffblock) {
LOGDEBUG("%s() OK shift stops at diff" LOGDEBUG("%s() OK shift stops for a diff"
" change '%s->%s' %"PRId64 " change '%s->%s' %"PRId64
"->%"PRId64" height %"PRId32 "->%"PRId64" height %"PRId32
" limit %"PRId64, " limit %"PRId64,
@ -4512,6 +4514,19 @@ static void make_a_shift_mark()
break; break;
} }
} }
// Halving? Stop at the last workinfo before it
if ((workinfo->height % BLOCK_HALVING) == 0) {
LOGDEBUG("%s() OK shift stops for a "
"halving wid %"PRId64
"->%"PRId64" height %"PRId32
" halving every %d",
__func__, prev_wid,
workinfo->workinfoid,
workinfo->height,
BLOCK_HALVING);
marks_wid = prev_wid;
break;
}
} }
/* Did we find a pool restart? i.e. a wid skip /* Did we find a pool restart? i.e. a wid skip
* These will usually be a much larger jump, * These will usually be a much larger jump,

2
src/ckdb.h

@ -52,7 +52,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.7" #define DB_VERSION "1.0.7"
#define CKDB_VERSION DB_VERSION"-2.200" #define CKDB_VERSION DB_VERSION"-2.201"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__

Loading…
Cancel
Save