aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_batch2_reserves_in_insert.c
diff options
context:
space:
mode:
authorJoseph <Joseph.xu@efrei.net>2022-12-05 04:53:24 -0500
committerJoseph <Joseph.xu@efrei.net>2022-12-06 08:11:14 -0500
commita71893d5f2afa9032b30ad73241b87ff4f6a9182 (patch)
tree0134e4db102441efab28f0161bb12719215c21db /src/exchangedb/pg_batch2_reserves_in_insert.c
parent6e3d1bdc91254a5bd57d58e5280e20813211157b (diff)
downloadexchange-a71893d5f2afa9032b30ad73241b87ff4f6a9182.tar.xz
plugin update
Diffstat (limited to 'src/exchangedb/pg_batch2_reserves_in_insert.c')
-rw-r--r--src/exchangedb/pg_batch2_reserves_in_insert.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/exchangedb/pg_batch2_reserves_in_insert.c b/src/exchangedb/pg_batch2_reserves_in_insert.c
index e4e015f96..1e318d10a 100644
--- a/src/exchangedb/pg_batch2_reserves_in_insert.c
+++ b/src/exchangedb/pg_batch2_reserves_in_insert.c
@@ -65,11 +65,15 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
struct TALER_PaytoHashP h_payto;
uint64_t reserve_uuid;
bool conflicted;
+ bool conflicted2;
bool transaction_duplicate;
+ bool transaction_duplicate2;
bool need_update = false;
+ bool need_update2 = false;
struct GNUNET_TIME_Timestamp reserve_expiration
= GNUNET_TIME_relative_to_timestamp (pg->idle_reserve_expiration_time);
bool conflicts[reserves_length];
+ bool conflicts2[reserves_length];
char *notify_s[reserves_length];
if (GNUNET_OK !=
@@ -82,10 +86,12 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
"reserve_create",
"SELECT "
"out_reserve_found AS conflicted"
+ ",out_reserve_found2 AS conflicted2"
",transaction_duplicate"
+ ",transaction_duplicate2"
",ruuid AS reserve_uuid"
" FROM batch2_reserves_insert"
- " ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17);");
+ " ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21);");
expiry = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (reserves->execution_time.abs_time,
pg->idle_reserve_expiration_time));
@@ -134,15 +140,21 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
GNUNET_PQ_query_param_timestamp (&reserve_expiration),
GNUNET_PQ_query_param_string (notify_s[i]),
GNUNET_PQ_query_param_auto_from_type (&reserve->reserve_pub),
+ GNUNET_PQ_query_param_uint64 (&reserve->wire_reference),
TALER_PQ_query_param_amount (&reserve->balance),
- GNUNET_PQ_query_param_timestamp (&expiry),
- GNUNET_PQ_query_param_timestamp (&gc),
+ GNUNET_PQ_query_param_string (reserve->exchange_account_name),
+ GNUNET_PQ_query_param_timestamp (&reserve->execution_time),
+ GNUNET_PQ_query_param_auto_from_type (&h_payto),
+ GNUNET_PQ_query_param_string (reserve->sender_account_details),
+ GNUNET_PQ_query_param_timestamp (&reserve_expiration),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_bool ("conflicted",
&conflicted),
+ GNUNET_PQ_result_spec_bool ("conflicted2",
+ &conflicted2),
GNUNET_PQ_result_spec_bool ("transaction_duplicate",
&transaction_duplicate),
GNUNET_PQ_result_spec_uint64 ("reserve_uuid",
@@ -171,14 +183,15 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
? GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
: GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
conflicts[i] = conflicted;
- // fprintf(stdout, "%d", conflicts[i]);
- if (!conflicts[i] && transaction_duplicate)
+ conflicts2[i] = conflicted2;
+ // fprintf(stdout, "%d", conflicts[i]);
+ if (!conflicts[i] && !conflicts2[i]&& transaction_duplicate)
{
GNUNET_break (0);
TEH_PG_rollback (pg);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- need_update |= conflicted;
+ need_update |= conflicted |= conflicted2;
}
// commit
{