diff --git a/src/bitcoin.c b/src/bitcoin.c index 71c576f0..272dd2a0 100644 --- a/src/bitcoin.c +++ b/src/bitcoin.c @@ -83,7 +83,6 @@ out: static bool gbt_merkle_bins(gbtbase_t *gbt, json_t *transaction_arr) { int i, j, binleft, binlen; - char hashhex[68]; json_t *arr_val; uchar *hashbin; @@ -147,7 +146,7 @@ static bool gbt_merkle_bins(gbtbase_t *gbt, json_t *transaction_arr) while (42) { if (binleft == 1) break; - memcpy(gbt->merklebin + (gbt->merkles * 32), hashbin + 32, 32); + memcpy(&gbt->merklebin[gbt->merkles][0], hashbin + 32, 32); gbt->merkles++; if (binleft % 2) { memcpy(hashbin + binlen, hashbin + binlen - 32, 32); @@ -161,8 +160,8 @@ static bool gbt_merkle_bins(gbtbase_t *gbt, json_t *transaction_arr) } } for (i = 0; i < gbt->merkles; i++) { - __bin2hex(hashhex, gbt->merklebin + i * 32, 32); - LOGDEBUG("MH%d %s",i, hashhex); + __bin2hex(&gbt->merklehash[i][0], &gbt->merklebin[i][0], 32); + LOGDEBUG("MH%d %s",i, &gbt->merklehash[i][0]); } LOGINFO("Stored %d transactions", gbt->transactions); return true; diff --git a/src/libckpool.h b/src/libckpool.h index c1f30e54..e4615256 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -120,7 +120,8 @@ struct gbtbase { uchar *txn_hashes; int transactions; int merkles; - uchar merklebin[16 * 32]; + uchar merklebin[16][32]; + char merklehash[16][68]; }; typedef struct gbtbase gbtbase_t;