Browse Source

We should also store the merkle hashes in the gbtbase structure

master
Con Kolivas 11 years ago
parent
commit
c653c781a3
  1. 7
      src/bitcoin.c
  2. 3
      src/libckpool.h

7
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;

3
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;

Loading…
Cancel
Save