implementing a few FIXMEs, adding refs to bugs for others
This commit is contained in:
parent
7df32f41a8
commit
0de322fda8
@ -2524,6 +2524,7 @@ postgres_get_link_data_list (void *cls,
|
|||||||
struct TALER_MINTDB_LinkDataList *ldl;
|
struct TALER_MINTDB_LinkDataList *ldl;
|
||||||
struct TALER_MINTDB_LinkDataList *pos;
|
struct TALER_MINTDB_LinkDataList *pos;
|
||||||
int i;
|
int i;
|
||||||
|
int nrows;
|
||||||
struct TALER_PQ_QueryParam params[] = {
|
struct TALER_PQ_QueryParam params[] = {
|
||||||
TALER_PQ_query_param_auto_from_type (coin_pub),
|
TALER_PQ_query_param_auto_from_type (coin_pub),
|
||||||
TALER_PQ_query_param_end
|
TALER_PQ_query_param_end
|
||||||
@ -2539,14 +2540,14 @@ postgres_get_link_data_list (void *cls,
|
|||||||
PQclear (result);
|
PQclear (result);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
nrows = PQntuples (result);
|
||||||
if (0 == PQntuples (result))
|
if (0 == nrows)
|
||||||
{
|
{
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < PQntuples (result); i++)
|
for (i = 0; i < nrows; i++)
|
||||||
{
|
{
|
||||||
struct TALER_RefreshLinkEncrypted *link_enc;
|
struct TALER_RefreshLinkEncrypted *link_enc;
|
||||||
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
|
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
|
||||||
@ -2676,29 +2677,20 @@ postgres_get_coin_transactions (void *cls,
|
|||||||
struct TALER_MINTDB_Session *session,
|
struct TALER_MINTDB_Session *session,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub)
|
const struct TALER_CoinSpendPublicKeyP *coin_pub)
|
||||||
{
|
{
|
||||||
PGresult *result;
|
|
||||||
struct TALER_MINTDB_TransactionList *head;
|
struct TALER_MINTDB_TransactionList *head;
|
||||||
struct TALER_MINTDB_TransactionList *tl;
|
|
||||||
int nrows;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
result = NULL;
|
|
||||||
head = NULL;
|
head = NULL;
|
||||||
tl = NULL;
|
|
||||||
nrows = 0;
|
|
||||||
ret = GNUNET_SYSERR;
|
|
||||||
|
|
||||||
/* check deposits */
|
/* check deposits */
|
||||||
{
|
{
|
||||||
struct TALER_MINTDB_Deposit *deposit;
|
|
||||||
struct TALER_PQ_QueryParam params[] = {
|
struct TALER_PQ_QueryParam params[] = {
|
||||||
TALER_PQ_query_param_auto_from_type (&coin_pub->eddsa_pub),
|
TALER_PQ_query_param_auto_from_type (&coin_pub->eddsa_pub),
|
||||||
TALER_PQ_query_param_end
|
TALER_PQ_query_param_end
|
||||||
};
|
};
|
||||||
json_error_t json_error;
|
int nrows;
|
||||||
void *json_wire_enc;
|
|
||||||
size_t json_wire_enc_size;
|
|
||||||
int i;
|
int i;
|
||||||
|
PGresult *result;
|
||||||
|
struct TALER_MINTDB_TransactionList *tl;
|
||||||
|
|
||||||
result = TALER_PQ_exec_prepared (session->conn,
|
result = TALER_PQ_exec_prepared (session->conn,
|
||||||
"get_deposit_with_coin_pub",
|
"get_deposit_with_coin_pub",
|
||||||
params);
|
params);
|
||||||
@ -2710,69 +2702,73 @@ postgres_get_coin_transactions (void *cls,
|
|||||||
nrows = PQntuples (result);
|
nrows = PQntuples (result);
|
||||||
for (i = 0; i < nrows; i++)
|
for (i = 0; i < nrows; i++)
|
||||||
{
|
{
|
||||||
|
struct TALER_MINTDB_Deposit *deposit;
|
||||||
|
json_error_t json_error;
|
||||||
|
void *json_wire_enc;
|
||||||
|
size_t json_wire_enc_size;
|
||||||
|
|
||||||
deposit = GNUNET_new (struct TALER_MINTDB_Deposit);
|
deposit = GNUNET_new (struct TALER_MINTDB_Deposit);
|
||||||
|
{
|
||||||
struct TALER_PQ_ResultSpec rs[] = {
|
struct TALER_PQ_ResultSpec rs[] = {
|
||||||
/* FIXME: deposit->coin needs to be initialized,
|
/* FIXME: deposit->coin needs to be initialized,
|
||||||
but 'coin_pub' from 'deposits' is not the (only) info we need here...
|
but 'coin_pub' from 'deposits' is not the (only) info we need here...
|
||||||
(#3820) */
|
(#3820) */
|
||||||
TALER_PQ_result_spec_auto_from_type ("transaction_id", &deposit->transaction_id),
|
TALER_PQ_result_spec_auto_from_type ("transaction_id", &deposit->transaction_id), /* FIXME: #3827 */
|
||||||
TALER_PQ_result_spec_auto_from_type ("coin_sig", &deposit->csig),
|
TALER_PQ_result_spec_auto_from_type ("coin_sig", &deposit->csig),
|
||||||
/* FIXME: do 'amount_with_fee' here! #3826 */
|
|
||||||
TALER_PQ_result_spec_auto_from_type ("merchant_pub", &deposit->merchant_pub),
|
TALER_PQ_result_spec_auto_from_type ("merchant_pub", &deposit->merchant_pub),
|
||||||
TALER_PQ_result_spec_auto_from_type ("h_contract", &deposit->h_contract),
|
TALER_PQ_result_spec_auto_from_type ("h_contract", &deposit->h_contract),
|
||||||
TALER_PQ_result_spec_auto_from_type ("h_wire", &deposit->h_wire),
|
TALER_PQ_result_spec_auto_from_type ("h_wire", &deposit->h_wire),
|
||||||
TALER_PQ_result_spec_variable_size ("wire", &json_wire_enc, &json_wire_enc_size),
|
TALER_PQ_result_spec_variable_size ("wire", &json_wire_enc, &json_wire_enc_size), /* FIXME: #3833 */
|
||||||
/** FIXME: , #3820
|
/** FIXME: , #3820
|
||||||
* TALER_PQ_result_spec_auto_from_type ("timestamp", &deposit->timestamp),
|
* TALER_PQ_result_spec_auto_from_type ("timestamp", &deposit->timestamp),
|
||||||
* TALER_PQ_result_spec_auto_from_type ("refund_deadline", &deposit->refund_deadline),
|
* TALER_PQ_result_spec_auto_from_type ("refund_deadline", &deposit->refund_deadline),
|
||||||
* TALER_PQ_RESULT_AMOUNT_NBO ("deposit_fee", &deposit->deposit_fee)
|
* TALER_PQ_RESULT_AMOUNT_NBO ("deposit_fee", &deposit->deposit_fee)
|
||||||
*/
|
*/
|
||||||
/* FIXME: probably want 'coin_sig' as well, #3820 */
|
/* FIXME: probably want 'coin_sig' as well, #3820 */
|
||||||
|
TALER_PQ_result_spec_amount ("amount_with_fee",
|
||||||
|
&deposit->amount_with_fee), /* FIXME: #3826? */
|
||||||
TALER_PQ_result_spec_end
|
TALER_PQ_result_spec_end
|
||||||
};
|
};
|
||||||
if ((GNUNET_OK != TALER_PQ_extract_result (result, rs, i)) ||
|
|
||||||
(GNUNET_OK != TALER_PQ_extract_amount (result,
|
if (GNUNET_OK !=
|
||||||
i,
|
TALER_PQ_extract_result (result, rs, i))
|
||||||
"amount_with_fee_val",
|
|
||||||
"amount_with_fee_frac",
|
|
||||||
"amount_with_fee_curr",
|
|
||||||
&deposit->amount_with_fee)))
|
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
goto cleanup_deposit;
|
GNUNET_free (deposit);
|
||||||
}
|
|
||||||
deposit->wire = json_loads (json_wire_enc,
|
|
||||||
JSON_REJECT_DUPLICATES,
|
|
||||||
&json_error);
|
|
||||||
if (NULL == deposit->wire)
|
|
||||||
{
|
|
||||||
TALER_json_warn (json_error);
|
|
||||||
goto cleanup_deposit;
|
|
||||||
}
|
|
||||||
GNUNET_free (json_wire_enc);
|
|
||||||
json_wire_enc = NULL;
|
|
||||||
deposit->transaction_id = GNUNET_ntohll (deposit->transaction_id);
|
|
||||||
tl = GNUNET_new (struct TALER_MINTDB_TransactionList);
|
|
||||||
tl->type = TALER_MINTDB_TT_DEPOSIT;
|
|
||||||
tl->details.deposit = deposit;
|
|
||||||
deposit = NULL;
|
|
||||||
continue;
|
|
||||||
cleanup_deposit:
|
|
||||||
GNUNET_free_non_null (json_wire_enc);
|
|
||||||
GNUNET_free_non_null (deposit);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIXME: check logic!
|
deposit->wire = json_loads (json_wire_enc,
|
||||||
/* We need to get this information from 3 tables:
|
JSON_REJECT_DUPLICATES,
|
||||||
1. Deposits
|
&json_error); /* FIXME: #3833 */
|
||||||
2. Coins used in for refreshing
|
if (NULL == deposit->wire)
|
||||||
3. locked coins (locking is not implemented as of now) */
|
{
|
||||||
cleanup:
|
TALER_json_warn (json_error);
|
||||||
if (GNUNET_OK == ret)
|
GNUNET_free (json_wire_enc);
|
||||||
|
GNUNET_free (deposit);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
GNUNET_free (json_wire_enc);
|
||||||
|
deposit->transaction_id = GNUNET_ntohll (deposit->transaction_id); /* FIXME: #3827 */
|
||||||
|
tl = GNUNET_new (struct TALER_MINTDB_TransactionList);
|
||||||
|
tl->next = head;
|
||||||
|
tl->type = TALER_MINTDB_TT_DEPOSIT;
|
||||||
|
tl->details.deposit = deposit;
|
||||||
|
head = tl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Handle refreshing */
|
||||||
|
{
|
||||||
|
/* FIXME: #3834 */
|
||||||
|
}
|
||||||
|
/* FIXME: support fetching information about locked coins
|
||||||
|
(locking is not implemented as of now, #3625) */
|
||||||
return head;
|
return head;
|
||||||
|
cleanup:
|
||||||
if (NULL != head)
|
if (NULL != head)
|
||||||
common_free_coin_transaction_list (cls, head);
|
common_free_coin_transaction_list (cls,
|
||||||
|
head);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user