Browse Source

Add to correct transaction table

master
ckolivas 9 years ago
parent
commit
55b52d0346
  1. 6
      src/stratifier.c

6
src/stratifier.c

@ -1117,7 +1117,7 @@ static void broadcast_ping(sdata_t *sdata);
/* Build a hashlist of all transactions, allowing us to compare with the list of /* Build a hashlist of all transactions, allowing us to compare with the list of
* existing transactions to determine which need to be propagated */ * existing transactions to determine which need to be propagated */
static void add_txn(sdata_t *sdata, txntable_t *txns, const char *hash, const char *data) static void add_txn(sdata_t *sdata, txntable_t **txns, const char *hash, const char *data)
{ {
bool found = false; bool found = false;
txntable_t *txn; txntable_t *txn;
@ -1137,7 +1137,7 @@ static void add_txn(sdata_t *sdata, txntable_t *txns, const char *hash, const ch
/* Note that data is pointing to a string in a json struture which will /* Note that data is pointing to a string in a json struture which will
* be destroyed so we can only use the data value until then. */ * be destroyed so we can only use the data value until then. */
txn->data = data; txn->data = data;
HASH_ADD_STR(txns, hash, txn); HASH_ADD_STR(*txns, hash, txn);
} }
/* Distill down a set of transactions into an efficient tree arrangement for /* Distill down a set of transactions into an efficient tree arrangement for
@ -1180,7 +1180,7 @@ static void wb_merkle_bins(sdata_t *sdata, workbase_t *wb, json_t *txn_array)
arr_val = json_array_get(txn_array, i); arr_val = json_array_get(txn_array, i);
hash = json_string_value(json_object_get(arr_val, "hash")); hash = json_string_value(json_object_get(arr_val, "hash"));
txn = json_string_value(json_object_get(arr_val, "data")); txn = json_string_value(json_object_get(arr_val, "data"));
add_txn(sdata, txns, hash, txn); add_txn(sdata, &txns, hash, txn);
len = strlen(txn); len = strlen(txn);
memcpy(wb->txn_data + ofs, txn, len); memcpy(wb->txn_data + ofs, txn, len);
ofs += len; ofs += len;

Loading…
Cancel
Save