diff --git a/src/ckdb.c b/src/ckdb.c index b856ac10..454d8e5b 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -535,6 +535,7 @@ K_ITEM *workinfo_current; tv_t last_bc; // current network diff double current_ndiff; +bool txn_tree_store = true; // SHARES shares.id.json={...} K_TREE *shares_root; @@ -2053,6 +2054,8 @@ static bool setup_data() LOGWARNING("%sStartup mark generation state is %s", markersummary_auto ? "" : "WARNING: ", markersummary_auto ? "On" : "Off"); + LOGWARNING("Workinfo transaction storage is %s", + txn_tree_store ? "On" : "Off"); alloc_storage(); @@ -7217,6 +7220,8 @@ static struct option long_options[] = { { "sockdir", required_argument, 0, 's' }, { "btc-server", required_argument, 0, 'S' }, { "btc-timeout", required_argument, 0, 't' }, + // Don't store the workinfo txn tree in the DB + { "no-txn-store", no_argument, 0, 'T' }, { "dbuser", required_argument, 0, 'u' }, { "btc-user", required_argument, 0, 'U' }, { "version", no_argument, 0, 'v' }, @@ -7259,7 +7264,7 @@ int main(int argc, char **argv) memset(&ckp, 0, sizeof(ckp)); ckp.loglevel = LOG_NOTICE; - while ((c = getopt_long(argc, argv, "a:b:B:c:d:D:ghi:Ikl:mM:n:p:P:r:R:s:S:t:u:U:vw:yY:", long_options, &i)) != -1) { + while ((c = getopt_long(argc, argv, "a:b:B:c:d:D:ghi:Ikl:mM:n:p:P:r:R:s:S:t:Tu:U:vw:yY:", long_options, &i)) != -1) { switch(c) { case 'a': len = strlen(optarg); @@ -7423,6 +7428,9 @@ int main(int argc, char **argv) case 'S': btc_server = strdup(optarg); break; + case 'T': + txn_tree_store = false; + break; case 't': btc_timeout = atoi(optarg); break; diff --git a/src/ckdb.h b/src/ckdb.h index 5cc6750a..69581185 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.113" +#define CKDB_VERSION DB_VERSION"-2.114" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ @@ -1816,6 +1816,7 @@ extern K_ITEM *workinfo_current; extern tv_t last_bc; // current network diff extern double current_ndiff; +extern bool txn_tree_store; // Offset in binary coinbase1 of the block number #define BLOCKNUM_OFFSET 42 diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index 9fc82dae..19fc0b36 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -2526,6 +2526,7 @@ static char *cmd_sharelog(PGconn *conn, char *cmd, char *id, K_ITEM *i_prevhash, *i_coinbase1, *i_coinbase2, *i_version, *i_bits; K_ITEM *i_ntime, *i_reward; bool igndup = false; + char *txn_tree; i_poolinstance = require_name(trf_root, "poolinstance", 1, NULL, reply, siz); if (!i_poolinstance) @@ -2556,6 +2557,10 @@ static char *cmd_sharelog(PGconn *conn, char *cmd, char *id, i_transactiontree = require_name(trf_root, "transactiontree", 0, NULL, reply, siz); if (!i_transactiontree) return strdup(reply); + if (txn_tree_store) + txn_tree = transfer_data(i_transactiontree); + else + txn_tree = EMPTY; i_merklehash = require_name(trf_root, "merklehash", 0, NULL, reply, siz); if (!i_merklehash) @@ -2591,7 +2596,7 @@ static char *cmd_sharelog(PGconn *conn, char *cmd, char *id, workinfoid = workinfo_add(conn, transfer_data(i_workinfoid), transfer_data(i_poolinstance), - transfer_data(i_transactiontree), + txn_tree, transfer_data(i_merklehash), transfer_data(i_prevhash), transfer_data(i_coinbase1),