some modifications for batch update
This commit is contained in:
parent
1c104ddf28
commit
b001046a1e
@ -79,7 +79,7 @@ BEGIN
|
|||||||
PERFORM pg_notify(in_notify, NULL);
|
PERFORM pg_notify(in_notify, NULL);
|
||||||
ELSE
|
ELSE
|
||||||
CLOSE curs;
|
CLOSE curs;
|
||||||
IF ! out_reserve_found
|
IF NOT in_reserve_found
|
||||||
THEN
|
THEN
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -819,15 +819,13 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum GNUNET_DB_QueryStatus qs3;
|
enum GNUNET_DB_QueryStatus qs3;
|
||||||
PREPARE (pg,
|
|
||||||
"reserves_update",
|
|
||||||
"CALL exchange_do_batch_reserves_update"
|
|
||||||
" ($1,$2,$3,$4,$5,$6,$7,$8,$9);");
|
|
||||||
for (unsigned int i = 0; i<reserves_length; i++)
|
for (unsigned int i = 0; i<reserves_length; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (! conflicts[i])
|
if (! conflicts[i])
|
||||||
continue;
|
continue;
|
||||||
|
// fprintf(stdout, "%d\n", conflicts[i]);
|
||||||
{
|
{
|
||||||
// const struct TALER_EXCHANGEDB_ReserveInInfo *reserve = &reserves[i];
|
// const struct TALER_EXCHANGEDB_ReserveInInfo *reserve = &reserves[i];
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
@ -841,7 +839,10 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
|
|||||||
GNUNET_PQ_query_param_string (notify_s[i]),
|
GNUNET_PQ_query_param_string (notify_s[i]),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
PREPARE (pg,
|
||||||
|
"reserves_update",
|
||||||
|
"CALL exchange_do_batch_reserves_update"
|
||||||
|
" ($1,$2,$3,$4,$5,$6,$7,$8,$9);");
|
||||||
qs3 = GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
qs3 = GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||||
"reserves_update",
|
"reserves_update",
|
||||||
params);
|
params);
|
||||||
|
@ -75,7 +75,7 @@ static int result;
|
|||||||
*/
|
*/
|
||||||
static struct TALER_EXCHANGEDB_Plugin *plugin;
|
static struct TALER_EXCHANGEDB_Plugin *plugin;
|
||||||
static struct TALER_DenomFeeSet fees;
|
static struct TALER_DenomFeeSet fees;
|
||||||
|
static struct TALER_MerchantWireHashP h_wire_wt;
|
||||||
|
|
||||||
struct DenomKeyPair
|
struct DenomKeyPair
|
||||||
{
|
{
|
||||||
@ -275,7 +275,7 @@ run (void *cls)
|
|||||||
const uint32_t num_partitions = 10;
|
const uint32_t num_partitions = 10;
|
||||||
struct DenomKeyPair *dkp = NULL;
|
struct DenomKeyPair *dkp = NULL;
|
||||||
struct GNUNET_TIME_Timestamp ts;
|
struct GNUNET_TIME_Timestamp ts;
|
||||||
struct TALER_EXCHANGEDB_Deposit depos;
|
struct TALER_EXCHANGEDB_Deposit depos[NUMBER_DEPOSIT];
|
||||||
struct GNUNET_TIME_Timestamp deadline;
|
struct GNUNET_TIME_Timestamp deadline;
|
||||||
struct TALER_Amount value;
|
struct TALER_Amount value;
|
||||||
union TALER_DenominationBlindingKeyP bks;
|
union TALER_DenominationBlindingKeyP bks;
|
||||||
@ -293,9 +293,6 @@ run (void *cls)
|
|||||||
ZR_BLK (&cbc2);
|
ZR_BLK (&cbc2);
|
||||||
RND_BLK (&reserve_pub);
|
RND_BLK (&reserve_pub);
|
||||||
|
|
||||||
memset (&depos,
|
|
||||||
0,
|
|
||||||
sizeof (depos));
|
|
||||||
memset (&ref,
|
memset (&ref,
|
||||||
0,
|
0,
|
||||||
sizeof (ref));
|
sizeof (ref));
|
||||||
@ -340,7 +337,6 @@ run (void *cls)
|
|||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_string_to_amount (CURRENCY ":0.000010",
|
TALER_string_to_amount (CURRENCY ":0.000010",
|
||||||
&fees.refund));
|
&fees.refund));
|
||||||
|
|
||||||
ts = GNUNET_TIME_timestamp_get ();
|
ts = GNUNET_TIME_timestamp_get ();
|
||||||
deadline = GNUNET_TIME_timestamp_get ();
|
deadline = GNUNET_TIME_timestamp_get ();
|
||||||
dkp = create_denom_key_pair (RSA_KEY_SIZE,
|
dkp = create_denom_key_pair (RSA_KEY_SIZE,
|
||||||
@ -402,49 +398,54 @@ run (void *cls)
|
|||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_set_zero (CURRENCY,
|
TALER_amount_set_zero (CURRENCY,
|
||||||
&cbc.withdraw_fee));
|
&cbc.withdraw_fee));
|
||||||
|
for (unsigned int i=0; i< NUMBER_DEPOSIT; i++)
|
||||||
|
{
|
||||||
|
fprintf(stdout, "%d\n", i);
|
||||||
|
depos[i].deposit_fee = fees.deposit;
|
||||||
|
|
||||||
/*wire + deposit for get_ready_deposit*/
|
RND_BLK (&depos[i].coin.coin_pub);
|
||||||
depos.deposit_fee = fees.deposit;
|
|
||||||
|
|
||||||
RND_BLK (&depos.coin.coin_pub);
|
|
||||||
|
|
||||||
TALER_denom_pub_hash (&dkp->pub,
|
TALER_denom_pub_hash (&dkp->pub,
|
||||||
&depos.coin.denom_pub_hash);
|
&depos[i].coin.denom_pub_hash);
|
||||||
TALER_denom_pub_hash (&dkp->pub,
|
// TALER_denom_pub_hash (&dkp->pub,
|
||||||
&ref.coin.denom_pub_hash);
|
// &ref.coin.denom_pub_hash);
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_denom_sig_unblind (&depos.coin.denom_sig,
|
TALER_denom_sig_unblind (&depos[i].coin.denom_sig,
|
||||||
&cbc.sig,
|
&cbc.sig,
|
||||||
&bks,
|
&bks,
|
||||||
&c_hash,
|
&c_hash,
|
||||||
&alg_values,
|
&alg_values,
|
||||||
&dkp->pub));
|
&dkp->pub));
|
||||||
|
|
||||||
|
RND_BLK (&depos[i].merchant_pub);
|
||||||
|
RND_BLK (&depos[i].csig);
|
||||||
|
RND_BLK (&depos[i].h_contract_terms);
|
||||||
|
RND_BLK (&depos[i].wire_salt);
|
||||||
|
depos[i].amount_with_fee = value;
|
||||||
|
depos[i].refund_deadline = deadline;
|
||||||
|
depos[i].wire_deadline = deadline;
|
||||||
|
depos[i].receiver_wire_account =
|
||||||
|
"payto://iban/DE67830654080004822650?receiver-name=Test";
|
||||||
|
TALER_merchant_wire_signature_hash (
|
||||||
|
"payto://iban/DE67830654080004822650?receiver-name=Test",
|
||||||
|
&depos[i].wire_salt,
|
||||||
|
&h_wire_wt);
|
||||||
|
depos[i].timestamp = ts;
|
||||||
|
result = 8;
|
||||||
{
|
{
|
||||||
uint64_t known_coin_id;
|
uint64_t known_coin_id;
|
||||||
struct TALER_DenominationHashP dph;
|
struct TALER_DenominationHashP dph;
|
||||||
struct TALER_AgeCommitmentHash agh;
|
struct TALER_AgeCommitmentHash agh;
|
||||||
|
|
||||||
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
|
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
|
||||||
plugin->ensure_coin_known (plugin->cls,
|
plugin->ensure_coin_known (plugin->cls,
|
||||||
&depos.coin,
|
&depos[i].coin,
|
||||||
&known_coin_id,
|
&known_coin_id,
|
||||||
&dph,
|
&dph,
|
||||||
&agh));
|
&agh));
|
||||||
}
|
}
|
||||||
{
|
|
||||||
RND_BLK (&depos.merchant_pub);
|
/*wire + deposit for get_ready_deposit*/
|
||||||
RND_BLK (&depos.csig);
|
|
||||||
RND_BLK (&depos.h_contract_terms);
|
|
||||||
RND_BLK (&depos.wire_salt);
|
|
||||||
depos.amount_with_fee = value;
|
|
||||||
depos.refund_deadline = deadline;
|
|
||||||
depos.wire_deadline = deadline;
|
|
||||||
depos.receiver_wire_account =
|
|
||||||
"payto://iban/DE67830654080004822650?receiver-name=Test";
|
|
||||||
depos.timestamp = ts;
|
|
||||||
result = 8;
|
|
||||||
}
|
|
||||||
/*STORE INTO DEPOSIT*/
|
/*STORE INTO DEPOSIT*/
|
||||||
{
|
{
|
||||||
struct GNUNET_TIME_Timestamp now;
|
struct GNUNET_TIME_Timestamp now;
|
||||||
@ -456,17 +457,17 @@ run (void *cls)
|
|||||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||||
plugin->insert_deposit (plugin->cls,
|
plugin->insert_deposit (plugin->cls,
|
||||||
now,
|
now,
|
||||||
&depos));
|
&depos[i]));
|
||||||
TALER_merchant_wire_signature_hash (depos.receiver_wire_account,
|
TALER_merchant_wire_signature_hash (depos[i].receiver_wire_account,
|
||||||
&depos.wire_salt,
|
&depos[i].wire_salt,
|
||||||
&h_wire);
|
&h_wire);
|
||||||
FAILIF (1 !=
|
FAILIF (1 !=
|
||||||
plugin->have_deposit2 (plugin->cls,
|
plugin->have_deposit2 (plugin->cls,
|
||||||
&depos.h_contract_terms,
|
&depos[i].h_contract_terms,
|
||||||
&h_wire,
|
&h_wire,
|
||||||
&depos.coin.coin_pub,
|
&depos[i].coin.coin_pub,
|
||||||
&depos.merchant_pub,
|
&depos[i].merchant_pub,
|
||||||
depos.refund_deadline,
|
depos[i].refund_deadline,
|
||||||
&deposit_fee,
|
&deposit_fee,
|
||||||
&r));
|
&r));
|
||||||
FAILIF (GNUNET_TIME_timestamp_cmp (now,
|
FAILIF (GNUNET_TIME_timestamp_cmp (now,
|
||||||
@ -483,12 +484,14 @@ run (void *cls)
|
|||||||
end_range = GNUNET_TIME_absolute_to_timestamp (
|
end_range = GNUNET_TIME_absolute_to_timestamp (
|
||||||
GNUNET_TIME_absolute_add (deadline.abs_time,
|
GNUNET_TIME_absolute_add (deadline.abs_time,
|
||||||
GNUNET_TIME_UNIT_SECONDS));
|
GNUNET_TIME_UNIT_SECONDS));
|
||||||
|
/*Aborted*/
|
||||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||||
plugin->select_deposits_missing_wire (plugin->cls,
|
plugin->select_deposits_missing_wire (plugin->cls,
|
||||||
start_range,
|
start_range,
|
||||||
end_range,
|
end_range,
|
||||||
&wire_missing_cb,
|
&wire_missing_cb,
|
||||||
&depos));
|
&depos[i]));
|
||||||
|
|
||||||
FAILIF (8 != result);
|
FAILIF (8 != result);
|
||||||
}
|
}
|
||||||
auditor_row_cnt = 0;
|
auditor_row_cnt = 0;
|
||||||
@ -512,9 +515,9 @@ run (void *cls)
|
|||||||
&merchant_pub2,
|
&merchant_pub2,
|
||||||
&payto_uri2));
|
&payto_uri2));
|
||||||
FAILIF (0 != GNUNET_memcmp (&merchant_pub2,
|
FAILIF (0 != GNUNET_memcmp (&merchant_pub2,
|
||||||
&depos.merchant_pub));
|
&depos[i].merchant_pub));
|
||||||
FAILIF (0 != strcmp (payto_uri2,
|
FAILIF (0 != strcmp (payto_uri2,
|
||||||
depos.receiver_wire_account));
|
depos[i].receiver_wire_account));
|
||||||
TALER_payto_hash (payto_uri2,
|
TALER_payto_hash (payto_uri2,
|
||||||
&wire_target_h_payto);
|
&wire_target_h_payto);
|
||||||
GNUNET_free (payto_uri2);
|
GNUNET_free (payto_uri2);
|
||||||
@ -531,6 +534,9 @@ run (void *cls)
|
|||||||
plugin->insert_refund (plugin->cls,
|
plugin->insert_refund (plugin->cls,
|
||||||
&ref));
|
&ref));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
drop:
|
drop:
|
||||||
GNUNET_break (GNUNET_OK ==
|
GNUNET_break (GNUNET_OK ==
|
||||||
@ -538,7 +544,9 @@ drop:
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (NULL != dkp)
|
if (NULL != dkp)
|
||||||
destroy_denom_key_pair (dkp);
|
destroy_denom_key_pair (dkp);
|
||||||
TALER_denom_sig_free (&depos.coin.denom_sig);
|
for (unsigned int i=0; i<NUMBER_DEPOSIT; i++){
|
||||||
|
TALER_denom_sig_free (&depos[i].coin.denom_sig);}
|
||||||
|
|
||||||
TALER_denom_sig_free (&ref.coin.denom_sig);
|
TALER_denom_sig_free (&ref.coin.denom_sig);
|
||||||
TALER_blinded_denom_sig_free (&cbc.sig);
|
TALER_blinded_denom_sig_free (&cbc.sig);
|
||||||
dkp = NULL;
|
dkp = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user