Commit 6c3135eaad3b552e6fac9b6c404ee2dbeb7f2077

Con Kolivas 2014-03-14T21:26:55

Add more gbt variable decoding from gbt solo information.

diff --git a/cgminer.c b/cgminer.c
index 1027665..b2564b3 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2204,12 +2204,13 @@ static void gbt_merkle_bins(struct pool *pool, json_t *transaction_arr)
 
 static bool gbt_solo_decode(struct pool *pool, json_t *res_val)
 {
-	json_t *transaction_arr;
 	const char *previousblockhash;
+	unsigned char hash_swap[32];
+	json_t *transaction_arr;
 	const char *target;
+	const char *bits;
 	int version;
 	int curtime;
-	const char *bits;
 	int height;
 
 	previousblockhash = json_string_value(json_object_get(res_val, "previousblockhash"));
@@ -2233,6 +2234,16 @@ static bool gbt_solo_decode(struct pool *pool, json_t *res_val)
 	applog(LOG_DEBUG, "bits: %s", bits);
 	applog(LOG_DEBUG, "height: %d", height);
 
+	hex2bin(hash_swap, previousblockhash, 32);
+	swap256(pool->previousblockhash, hash_swap);
+
+	hex2bin(hash_swap, target, 32);
+	swab256(pool->gbt_target, hash_swap);
+
+	pool->gbt_version = htobe32(version);
+	pool->curtime = htobe32(curtime);
+	hex2bin((unsigned char *)&pool->gbt_bits, bits, 4);
+
 	return true;
 }