fix exchangedb build errors

This commit is contained in:
Christian Grothoff 2023-03-31 13:50:32 +02:00
parent 9cce35d270
commit 6eed8917c3
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
158 changed files with 696 additions and 750 deletions

View File

@ -116,6 +116,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
pg_reserves_in_insert.h pg_reserves_in_insert.c \ pg_reserves_in_insert.h pg_reserves_in_insert.c \
pg_get_withdraw_info.h pg_get_withdraw_info.c \ pg_get_withdraw_info.h pg_get_withdraw_info.c \
pg_get_age_withdraw_info.c pg_get_age_withdraw_info.h \ pg_get_age_withdraw_info.c pg_get_age_withdraw_info.h \
pg_batch_ensure_coin_known.h pg_batch_ensure_coin_known.c \
pg_do_batch_withdraw.h pg_do_batch_withdraw.c \ pg_do_batch_withdraw.h pg_do_batch_withdraw.c \
pg_get_policy_details.h pg_get_policy_details.c \ pg_get_policy_details.h pg_get_policy_details.c \
pg_persist_policy_details.h pg_persist_policy_details.c \ pg_persist_policy_details.h pg_persist_policy_details.c \

View File

@ -39,4 +39,5 @@ TEH_PG_abort_shard (void *cls,
const char *job_name, const char *job_name,
uint64_t start_row, uint64_t start_row,
uint64_t end_row); uint64_t end_row);
#endif #endif

View File

@ -86,4 +86,3 @@ TEH_PG_add_denomination_key (
"denomination_insert", "denomination_insert",
iparams); iparams);
} }

View File

@ -26,14 +26,10 @@
#include "pg_helper.h" #include "pg_helper.h"
static enum GNUNET_DB_QueryStatus
insert1 (struct PostgresClosure *pg,
const struct TALER_CoinPublicInfo coin[1],
struct TALER_EXCHANGEDB_CoinInfo result[1])
static enum TALER_EXCHANGEDB_CoinKnownStatus
insert1 (struct PosgresClosure *pg,
const struct TALER_CoinPublicInfo *coin[1],
const struct TALER_EXCHANGEDB_CoinInfo *result[1])
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null = false; bool is_denom_pub_hash_null = false;
@ -57,16 +53,16 @@ insert1 (struct PosgresClosure *pg,
}; };
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_bool ("existed", GNUNET_PQ_result_spec_bool ("existed",
result[0].existed), &result[0].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id", GNUNET_PQ_result_spec_uint64 ("known_coin_id",
result[0].known_coin_id), &result[0].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
result[0].denom_hash), &result[0].denom_hash),
&is_denom_pub_hash_null), &is_denom_pub_hash_null),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
result[0].h_age_commitment), &result[0].h_age_commitment),
&is_age_hash_null), &is_age_hash_null),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -79,47 +75,47 @@ insert1 (struct PosgresClosure *pg,
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return qs;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
return TALER_EXCHANGEDB_CKS_SOFT_FAIL; return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0); /* should be impossible */ GNUNET_break (0); /* should be impossible */
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return GNUNET_DB_STATUS_HARD_ERROR;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
if (! existed)
return TALER_EXCHANGEDB_CKS_ADDED;
break; /* continued below */ break; /* continued below */
} }
if ( (! is_denom_pub_hash_null) && if ( (! is_denom_pub_hash_null) &&
(0 != GNUNET_memcmp (&denom_hash->hash, (0 != GNUNET_memcmp (&result[0].denom_hash,
&coin->denom_pub_hash.hash)) ) &coin->denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[0].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment, (0 != GNUNET_memcmp (&result[0].h_age_commitment,
&coin->h_age_commitment)) ) &coin->h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment)); GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[0].age_conflict = true;
} }
return TALER_EXCHANGEDB_CKS_PRESENT; return qs;
} }
static enum TALER_EXCHANGEDB_CoinKnownStatus
insert2 (struct PosgresClosure *pg, static enum GNUNET_DB_QueryStatus
const struct TALER_CoinPublicInfo *coin[2], insert2 (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_CoinInfo *result[2]) const struct TALER_CoinPublicInfo coin[2],
struct TALER_EXCHANGEDB_CoinInfo result[2])
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null = false; bool is_denom_pub_hash_null = false;
bool is_age_hash_null = false; bool is_age_hash_null = false;
bool is_denom_pub_hash_null2 = false; bool is_denom_pub_hash_null2 = false;
bool is_age_hash_null2 = false; bool is_age_hash_null2 = false;
PREPARE (pg, PREPARE (pg,
"batch2_known_coin", "batch2_known_coin",
"SELECT" "SELECT"
@ -148,21 +144,21 @@ insert2 (struct PosgresClosure *pg,
}; };
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_bool ("existed", GNUNET_PQ_result_spec_bool ("existed",
result[0].existed), &result[0].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id", GNUNET_PQ_result_spec_uint64 ("known_coin_id",
result[0].known_coin_id), &result[0].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
result[0].denom_hash), &result[0].denom_hash),
&is_denom_pub_hash_null), &is_denom_pub_hash_null),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
result[0].h_age_commitment[0]), &result[0].h_age_commitment),
&is_age_hash_null), &is_age_hash_null),
GNUNET_PQ_result_spec_bool ("existed2", GNUNET_PQ_result_spec_bool ("existed2",
result[1].existed), &result[1].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id2", GNUNET_PQ_result_spec_uint64 ("known_coin_id2",
result[1].known_coin_id), &result[1].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2",
&result[1].denom_hash), &result[1].denom_hash),
@ -182,57 +178,56 @@ insert2 (struct PosgresClosure *pg,
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return qs;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
return TALER_EXCHANGEDB_CKS_SOFT_FAIL; return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0); /* should be impossible */ GNUNET_break (0); /* should be impossible */
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return GNUNET_DB_STATUS_HARD_ERROR;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
if (! existed)
return TALER_EXCHANGEDB_CKS_ADDED;
break; /* continued below */ break; /* continued below */
} }
if ( (! is_denom_pub_hash_null) && if ( (! is_denom_pub_hash_null) &&
(0 != GNUNET_memcmp (&denom_hash[0].hash, (0 != GNUNET_memcmp (&result[0].denom_hash,
&coin[0].denom_pub_hash.hash)) ) &coin[0].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[0].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment[0], (0 != GNUNET_memcmp (&result[0].h_age_commitment,
&coin[0].h_age_commitment)) ) &coin[0].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[0])); GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[0].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null2) && if ( (! is_denom_pub_hash_null2) &&
(0 != GNUNET_memcmp (&denom_hash[1].hash, (0 != GNUNET_memcmp (&result[1].denom_hash,
&coin[1].denom_pub_hash.hash)) ) &coin[1].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[1].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment[1], (0 != GNUNET_memcmp (&result[1].h_age_commitment,
&coin[1].h_age_commitment)) ) &coin[1].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[1])); GNUNET_break (GNUNET_is_zero (&result[1].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[1].age_conflict = true;
} }
return TALER_EXCHANGEDB_CKS_PRESENT; return qs;
} }
static enum TALER_EXCHANGEDB_CoinKnownStatus
insert4 (struct PosgresClosure *pg, static enum GNUNET_DB_QueryStatus
const struct TALER_CoinPublicInfo *coin[4], insert4 (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_CoinInfo *result[4]) const struct TALER_CoinPublicInfo coin[4],
struct TALER_EXCHANGEDB_CoinInfo result[4])
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null = false; bool is_denom_pub_hash_null = false;
@ -289,52 +284,52 @@ insert4 (struct PosgresClosure *pg,
}; };
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_bool ("existed", GNUNET_PQ_result_spec_bool ("existed",
result[0].existed), &result[0].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id", GNUNET_PQ_result_spec_uint64 ("known_coin_id",
result[0].known_coin_id), &result[0].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
result[0].denom_hash), &result[0].denom_hash),
&is_denom_pub_hash_null), &is_denom_pub_hash_null),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
result[0].h_age_commitment), &result[0].h_age_commitment),
&is_age_hash_null), &is_age_hash_null),
GNUNET_PQ_result_spec_bool ("existed2", GNUNET_PQ_result_spec_bool ("existed2",
result[1].existed), &result[1].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id2", GNUNET_PQ_result_spec_uint64 ("known_coin_id2",
result[1].known_coin_id), &result[1].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2",
result[1].denom_hash), &result[1].denom_hash),
&is_denom_pub_hash_null2), &is_denom_pub_hash_null2),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash2", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash2",
result[1].h_age_commitment), &result[1].h_age_commitment),
&is_age_hash_null2), &is_age_hash_null2),
GNUNET_PQ_result_spec_bool ("existed3", GNUNET_PQ_result_spec_bool ("existed3",
result[2].existed), &result[2].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id3", GNUNET_PQ_result_spec_uint64 ("known_coin_id3",
result[2].known_coin_id), &result[2].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash3", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash3",
result[2].denom_hash), &result[2].denom_hash),
&is_denom_pub_hash_null3), &is_denom_pub_hash_null3),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash3", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash3",
result[2].h_age_commitment), &result[2].h_age_commitment),
&is_age_hash_null3), &is_age_hash_null3),
GNUNET_PQ_result_spec_bool ("existed4", GNUNET_PQ_result_spec_bool ("existed4",
result[3].existed), &result[3].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id4", GNUNET_PQ_result_spec_uint64 ("known_coin_id4",
result[3].known_coin_id), &result[3].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash4", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash4",
result[3].denom_hash), &result[3].denom_hash),
&is_denom_pub_hash_null4), &is_denom_pub_hash_null4),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash4", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash4",
result[3].h_age_commitment), &result[3].h_age_commitment),
&is_age_hash_null4), &is_age_hash_null4),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -347,113 +342,105 @@ insert4 (struct PosgresClosure *pg,
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return qs;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
return TALER_EXCHANGEDB_CKS_SOFT_FAIL; return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0); /* should be impossible */ GNUNET_break (0); /* should be impossible */
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return GNUNET_DB_STATUS_HARD_ERROR;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
if (! existed)
return TALER_EXCHANGEDB_CKS_ADDED;
break; /* continued below */ break; /* continued below */
} }
if ( (! is_denom_pub_hash_null) && if ( (! is_denom_pub_hash_null) &&
(0 != GNUNET_memcmp (result[0].denom_hash.hash, (0 != GNUNET_memcmp (&result[0].denom_hash,
&coin[0].denom_pub_hash.hash)) ) &coin[0].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[0].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment[0], (0 != GNUNET_memcmp (&result[0].h_age_commitment,
&coin[0].h_age_commitment)) ) &coin[0].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[0])); GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[0].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null2) && if ( (! is_denom_pub_hash_null2) &&
(0 != GNUNET_memcmp (&denom_hash[1].hash, (0 != GNUNET_memcmp (&result[1].denom_hash,
&coin[1].denom_pub_hash.hash)) ) &coin[1].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[1].denom_conflict = true;
} }
if ( (! is_age_hash_null2) && if ( (! is_age_hash_null2) &&
(0 != GNUNET_memcmp (h_age_commitment[1], (0 != GNUNET_memcmp (&result[1].h_age_commitment,
&coin[1].h_age_commitment)) ) &coin[1].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[1])); GNUNET_break (GNUNET_is_zero (&result[1].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[1].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null3) && if ( (! is_denom_pub_hash_null3) &&
(0 != GNUNET_memcmp (&denom_hash[2].hash, (0 != GNUNET_memcmp (&result[2].denom_hash,
&coin[2].denom_pub_hash.hash)) ) &coin[2].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[2].denom_conflict = true;
} }
if ( (! is_age_hash_null3) && if ( (! is_age_hash_null3) &&
(0 != GNUNET_memcmp (h_age_commitment[2], (0 != GNUNET_memcmp (&result[2].h_age_commitment,
&coin[2].h_age_commitment)) ) &coin[2].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[2])); GNUNET_break (GNUNET_is_zero (&result[2].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[2].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null4) && if ( (! is_denom_pub_hash_null4) &&
(0 != GNUNET_memcmp (&denom_hash[3].hash, (0 != GNUNET_memcmp (&result[3].denom_hash,
&coin[3].denom_pub_hash.hash)) ) &coin[3].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[3].denom_conflict = true;
} }
if ( (! is_age_hash_null4) && if ( (! is_age_hash_null4) &&
(0 != GNUNET_memcmp (h_age_commitment[3], (0 != GNUNET_memcmp (&result[3].h_age_commitment,
&coin[3].h_age_commitment)) ) &coin[3].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[3])); GNUNET_break (GNUNET_is_zero (&result[3].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[3].age_conflict = true;
} }
return qs;
return TALER_EXCHANGEDB_CKS_PRESENT;
} }
enum GNUNET_DB_QueryStatus
enum TALER_EXCHANGEDB_CoinKnownStatus TEH_PG_batch_ensure_coin_known (
TEH_PG_batch_ensure_coin_known (void *cls, void *cls,
const struct const struct TALER_CoinPublicInfo *coin,
TALER_CoinPublicInfo *coin, struct TALER_EXCHANGEDB_CoinInfo *result,
const struct
TALER_EXCHANGEDB_CoinInfo *result,
unsigned int coin_length, unsigned int coin_length,
unsigned int batch_size) unsigned int batch_size)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
enum TALER_EXCHANGEDB_CoinKnownStatus qs1; enum GNUNET_DB_QueryStatus qs = 0;
enum TALER_EXCHANGEDB_CoinKnownStatus qs2;
enum TALER_EXCHANGEDB_CoinKnownStatus qs4;
unsigned int i = 0; unsigned int i = 0;
while (i < coin_length) while ( (qs >= 0) &&
(i < coin_length) )
{ {
unsigned int bs = GNUNET_MIN (batch_size, unsigned int bs = GNUNET_MIN (batch_size,
coin_length - i); coin_length - i);
bs = 1;
if (bs >= 4) if (bs >= 4)
{ {
qs4 = insert4 (pg, qs = insert4 (pg,
&coin[i], &coin[i],
&result[i] &result[i]);
);
i += 4; i += 4;
continue; continue;
} }
@ -461,17 +448,15 @@ TEH_PG_batch_ensure_coin_known (void *cls,
{ {
case 3: case 3:
case 2: case 2:
qs2 = insert2 (pg, qs = insert2 (pg,
&coin[i], &coin[i],
&result[i] &result[i]);
);
i += 2; i += 2;
break; break;
case 1: case 1:
qs1 = insert1 (pg, qs = insert1 (pg,
&coin[i], &coin[i],
&result[i] &result[i]);
);
i += 1; i += 1;
break; break;
case 0: case 0:
@ -479,5 +464,7 @@ TEH_PG_batch_ensure_coin_known (void *cls,
break; break;
} }
} /* end while */ } /* end while */
return TALER_EXCHANGEDB_CKS_PRESENT; if (qs < 0)
return qs;
return i;
} }

View File

@ -24,12 +24,14 @@
#include "taler_util.h" #include "taler_util.h"
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_exchangedb_plugin.h" #include "taler_exchangedb_plugin.h"
enum TALER_EXCHANGEDB_CoinKnownStatus
TEH_PG_batch_ensure_coin_known (void *cls,
const struct enum GNUNET_DB_QueryStatus
TALER_CoinPublicInfo *coin, TEH_PG_batch_ensure_coin_known (
const struct void *cls,
TALER_EXCHANGEDB_CoinInfo *result, const struct TALER_CoinPublicInfo *coin,
struct TALER_EXCHANGEDB_CoinInfo *result,
unsigned int coin_length, unsigned int coin_length,
unsigned int batch_size); unsigned int batch_size);
#endif #endif

View File

@ -45,4 +45,5 @@ TEH_PG_begin_revolving_shard (void *cls,
uint32_t shard_limit, uint32_t shard_limit,
uint32_t *start_row, uint32_t *start_row,
uint32_t *end_row); uint32_t *end_row);
#endif #endif

View File

@ -39,4 +39,5 @@ TEH_PG_complete_shard (void *cls,
const char *job_name, const char *job_name,
uint64_t start_row, uint64_t start_row,
uint64_t end_row); uint64_t end_row);
#endif #endif

View File

@ -48,5 +48,3 @@ TEH_PG_delete_aggregation_transient (
"delete_aggregation_transient", "delete_aggregation_transient",
params); params);
} }

View File

@ -39,4 +39,3 @@ TEH_PG_delete_shard_locks (void *cls)
return GNUNET_PQ_exec_statements (pg->conn, return GNUNET_PQ_exec_statements (pg->conn,
es); es);
} }

View File

@ -75,4 +75,3 @@ TEH_PG_do_batch_withdraw (
params, params,
rs); rs);
} }

View File

@ -70,7 +70,6 @@ TEH_PG_do_recoup (
}; };
PREPARE (pg, PREPARE (pg,
"call_recoup", "call_recoup",
"SELECT " "SELECT "

View File

@ -53,4 +53,5 @@ TEH_PG_do_recoup_refresh (
struct GNUNET_TIME_Timestamp *recoup_timestamp, struct GNUNET_TIME_Timestamp *recoup_timestamp,
bool *recoup_ok, bool *recoup_ok,
bool *internal_failure); bool *internal_failure);
#endif #endif

View File

@ -82,5 +82,3 @@ TEH_PG_do_withdraw (
params, params,
rs); rs);
} }

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
void void
TEH_PG_event_listen_cancel (void *cls, TEH_PG_event_listen_cancel (void *cls,
struct GNUNET_DB_EventHandler *eh) struct GNUNET_DB_EventHandler *eh)

View File

@ -35,4 +35,5 @@
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TEH_PG_gc (void *cls); TEH_PG_gc (void *cls);
#endif #endif

View File

@ -67,5 +67,3 @@ TEH_PG_get_coin_denomination (
params, params,
rs); rs);
} }

View File

@ -41,4 +41,5 @@ TEH_PG_get_denomination_revocation (
const struct TALER_DenominationHashP *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_MasterSignatureP *master_sig, struct TALER_MasterSignatureP *master_sig,
uint64_t *rowid); uint64_t *rowid);
#endif #endif

View File

@ -38,4 +38,5 @@ enum GNUNET_DB_QueryStatus
TEH_PG_get_extension_manifest (void *cls, TEH_PG_get_extension_manifest (void *cls,
const char *extension_name, const char *extension_name,
char **manifest); char **manifest);
#endif #endif

View File

@ -121,7 +121,6 @@ global_fees_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_global_fees (void *cls, TEH_PG_get_global_fees (void *cls,
TALER_EXCHANGEDB_GlobalFeeCallback cb, TALER_EXCHANGEDB_GlobalFeeCallback cb,
@ -169,7 +168,3 @@ TEH_PG_get_global_fees (void *cls,
&global_fees_cb, &global_fees_cb,
&gctx); &gctx);
} }

View File

@ -37,4 +37,5 @@ enum GNUNET_DB_QueryStatus
TEH_PG_get_global_fees (void *cls, TEH_PG_get_global_fees (void *cls,
TALER_EXCHANGEDB_GlobalFeeCallback cb, TALER_EXCHANGEDB_GlobalFeeCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_old_coin_by_h_blind ( TEH_PG_get_old_coin_by_h_blind (
void *cls, void *cls,

View File

@ -41,4 +41,5 @@ TEH_PG_get_old_coin_by_h_blind (
const struct TALER_BlindedCoinHashP *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
struct TALER_CoinSpendPublicKeyP *old_coin_pub, struct TALER_CoinSpendPublicKeyP *old_coin_pub,
uint64_t *rrc_serial); uint64_t *rrc_serial);
#endif #endif

View File

@ -57,7 +57,6 @@ TEH_PG_get_policy_details (
}; };
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_policy_details", "get_policy_details",
params, params,

View File

@ -80,4 +80,3 @@ TEH_PG_get_purse_request (
params, params,
rs); rs);
} }

View File

@ -133,9 +133,6 @@ add_revealed_coins (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_refresh_reveal (void *cls, TEH_PG_get_refresh_reveal (void *cls,
const struct TALER_RefreshCommitmentP *rc, const struct TALER_RefreshCommitmentP *rc,

View File

@ -92,8 +92,6 @@ get_wire_accounts_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_wire_accounts (void *cls, TEH_PG_get_wire_accounts (void *cls,
TALER_EXCHANGEDB_WireAccountCallback cb, TALER_EXCHANGEDB_WireAccountCallback cb,

View File

@ -55,7 +55,6 @@ TEH_PG_get_wire_fee (void *cls,
}; };
/* Used in #postgres_get_wire_fee() */ /* Used in #postgres_get_wire_fee() */
PREPARE (pg, PREPARE (pg,
"get_wire_fee", "get_wire_fee",

View File

@ -51,4 +51,3 @@ TEH_PG_insert_aggregation_tracking (
"insert_aggregation_tracking", "insert_aggregation_tracking",
params); params);
} }

View File

@ -40,4 +40,3 @@ TEH_PG_insert_aggregation_tracking (
unsigned long long deposit_serial_id); unsigned long long deposit_serial_id);
#endif #endif

View File

@ -41,4 +41,5 @@ TEH_PG_insert_kyc_requirement_for_account (
const char *provider_section, const char *provider_section,
const struct TALER_PaytoHashP *h_payto, const struct TALER_PaytoHashP *h_payto,
uint64_t *requirement_row); uint64_t *requirement_row);
#endif #endif

View File

@ -45,4 +45,5 @@ TEH_PG_insert_kyc_requirement_process (
const char *provider_account_id, const char *provider_account_id,
const char *provider_legitimization_id, const char *provider_legitimization_id,
uint64_t *process_row); uint64_t *process_row);
#endif #endif

View File

@ -38,4 +38,5 @@ enum GNUNET_DB_QueryStatus
TEH_PG_iterate_active_auditors (void *cls, TEH_PG_iterate_active_auditors (void *cls,
TALER_EXCHANGEDB_AuditorsCallback cb, TALER_EXCHANGEDB_AuditorsCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -41,4 +41,5 @@ TEH_PG_iterate_auditor_denominations (
void *cls, void *cls,
TALER_EXCHANGEDB_AuditorDenominationsCallback cb, TALER_EXCHANGEDB_AuditorDenominationsCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_kyc_provider_account_lookup ( TEH_PG_kyc_provider_account_lookup (
void *cls, void *cls,

View File

@ -44,4 +44,5 @@ TEH_PG_kyc_provider_account_lookup (
const char *provider_legitimization_id, const char *provider_legitimization_id,
struct TALER_PaytoHashP *h_payto, struct TALER_PaytoHashP *h_payto,
uint64_t *process_row); uint64_t *process_row);
#endif #endif

View File

@ -48,4 +48,5 @@ TEH_PG_lookup_global_fee_by_time (
struct GNUNET_TIME_Relative *purse_timeout, struct GNUNET_TIME_Relative *purse_timeout,
struct GNUNET_TIME_Relative *history_expiration, struct GNUNET_TIME_Relative *history_expiration,
uint32_t *purse_account_limit); uint32_t *purse_account_limit);
#endif #endif

View File

@ -47,4 +47,5 @@ TEH_PG_lookup_kyc_process_by_account (
struct GNUNET_TIME_Absolute *expiration, struct GNUNET_TIME_Absolute *expiration,
char **provider_account_id, char **provider_account_id,
char **provider_legitimization_id); char **provider_legitimization_id);
#endif #endif

View File

@ -62,4 +62,3 @@ TEH_PG_lookup_signing_key (
params, params,
rs); rs);
} }

View File

@ -47,9 +47,3 @@ TEH_PG_profit_drains_set_finished (
"drain_profit_set_finished", "drain_profit_set_finished",
params); params);
} }

View File

@ -779,7 +779,8 @@ TEH_PG_reserves_in_insert (void *cls,
&conflicts[i], &conflicts[i],
&reserve_uuid[i], &reserve_uuid[i],
&results[i]); &results[i]);
fprintf(stdout, "reserve uuid : %ld c :%d t:%d\n", reserve_uuid[i], conflicts[i], transaction_duplicate[i]); fprintf (stdout, "reserve uuid : %ld c :%d t:%d\n", reserve_uuid[i],
conflicts[i], transaction_duplicate[i]);
if (qs2<0) if (qs2<0)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,

View File

@ -26,8 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
/** /**
* Closure for #get_kyc_amounts_cb(). * Closure for #get_kyc_amounts_cb().
*/ */
@ -112,7 +110,6 @@ get_kyc_amounts_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_aggregation_amounts_for_kyc_check ( TEH_PG_select_aggregation_amounts_for_kyc_check (
void *cls, void *cls,

View File

@ -44,4 +44,5 @@ TEH_PG_select_aggregation_amounts_for_kyc_check (
struct GNUNET_TIME_Absolute time_limit, struct GNUNET_TIME_Absolute time_limit,
TALER_EXCHANGEDB_KycAmountCallback kac, TALER_EXCHANGEDB_KycAmountCallback kac,
void *kac_cls); void *kac_cls);
#endif #endif

View File

@ -64,4 +64,3 @@ TEH_PG_select_auditor_denom_sig (
params, params,
rs); rs);
} }

View File

@ -164,7 +164,6 @@ TEH_PG_select_deposits_missing_wire (void *cls,
" ORDER BY wire_deadline ASC"); " ORDER BY wire_deadline ASC");
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
"deposits_get_overdue", "deposits_get_overdue",
params, params,

View File

@ -113,8 +113,6 @@ history_request_serial_helper_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_history_requests_above_serial_id ( TEH_PG_select_history_requests_above_serial_id (
void *cls, void *cls,

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
/** /**
* Closure for #get_kyc_amounts_cb(). * Closure for #get_kyc_amounts_cb().
*/ */
@ -157,4 +156,3 @@ TEH_PG_select_merge_amounts_for_kyc_check (
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
return qs; return qs;
} }

View File

@ -112,7 +112,6 @@ purse_decision_serial_helper_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_purse_decisions_above_serial_id ( TEH_PG_select_purse_decisions_above_serial_id (
void *cls, void *cls,

View File

@ -43,4 +43,5 @@ TEH_PG_select_purse_decisions_above_serial_id (
bool refunded, bool refunded,
TALER_EXCHANGEDB_PurseDecisionCallback cb, TALER_EXCHANGEDB_PurseDecisionCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
/** /**
* Closure for #recoup_serial_helper_cb(). * Closure for #recoup_serial_helper_cb().
*/ */
@ -137,6 +136,7 @@ recoup_serial_helper_cb (void *cls,
} }
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_recoup_above_serial_id ( TEH_PG_select_recoup_above_serial_id (
void *cls, void *cls,

View File

@ -141,7 +141,6 @@ recoup_refresh_serial_helper_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_recoup_refresh_above_serial_id ( TEH_PG_select_recoup_refresh_above_serial_id (
void *cls, void *cls,

View File

@ -130,10 +130,6 @@ refreshs_serial_helper_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_refreshes_above_serial_id ( TEH_PG_select_refreshes_above_serial_id (
void *cls, void *cls,

View File

@ -44,4 +44,5 @@ TEH_PG_select_refunds_by_coin (
const struct TALER_PrivateContractHashP *h_contract, const struct TALER_PrivateContractHashP *h_contract,
TALER_EXCHANGEDB_RefundCoinCallback cb, TALER_EXCHANGEDB_RefundCoinCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -113,7 +113,6 @@ wire_out_serial_helper_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_wire_out_above_serial_id ( TEH_PG_select_wire_out_above_serial_id (
void *cls, void *cls,

View File

@ -112,6 +112,7 @@ wire_out_serial_helper_cb (void *cls,
} }
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_wire_out_above_serial_id_by_account ( TEH_PG_select_wire_out_above_serial_id_by_account (
void *cls, void *cls,

View File

@ -43,4 +43,5 @@ TEH_PG_select_wire_out_above_serial_id_by_account (
uint64_t serial_id, uint64_t serial_id,
TALER_EXCHANGEDB_WireTransferOutCallback cb, TALER_EXCHANGEDB_WireTransferOutCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -44,4 +44,5 @@ TEH_PG_select_withdraw_amounts_for_kyc_check (
struct GNUNET_TIME_Absolute time_limit, struct GNUNET_TIME_Absolute time_limit,
TALER_EXCHANGEDB_KycAmountCallback kac, TALER_EXCHANGEDB_KycAmountCallback kac,
void *kac_cls); void *kac_cls);
#endif #endif

View File

@ -121,7 +121,6 @@ reserves_out_serial_helper_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_select_withdrawals_above_serial_id ( TEH_PG_select_withdrawals_above_serial_id (
void *cls, void *cls,

View File

@ -41,4 +41,5 @@ TEH_PG_select_withdrawals_above_serial_id (
uint64_t serial_id, uint64_t serial_id,
TALER_EXCHANGEDB_WithdrawCallback cb, TALER_EXCHANGEDB_WithdrawCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -50,6 +50,3 @@ TEH_PG_set_purse_balance (
"set_purse_balance", "set_purse_balance",
params); params);
} }

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_update_aggregation_transient ( TEH_PG_update_aggregation_transient (
void *cls, void *cls,

View File

@ -42,4 +42,5 @@ TEH_PG_wire_prepare_data_get (void *cls,
uint64_t limit, uint64_t limit,
TALER_EXCHANGEDB_WirePreparationIterator cb, TALER_EXCHANGEDB_WirePreparationIterator cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -39,4 +39,5 @@ TEH_PG_wire_prepare_data_insert (void *cls,
const char *type, const char *type,
const char *buf, const char *buf,
size_t buf_size); size_t buf_size);
#endif #endif

View File

@ -36,4 +36,5 @@ enum GNUNET_DB_QueryStatus
TEH_PG_wire_prepare_data_mark_failed ( TEH_PG_wire_prepare_data_mark_failed (
void *cls, void *cls,
uint64_t rowid); uint64_t rowid);
#endif #endif

View File

@ -36,4 +36,5 @@ enum GNUNET_DB_QueryStatus
TEH_PG_wire_prepare_data_mark_finished ( TEH_PG_wire_prepare_data_mark_finished (
void *cls, void *cls,
uint64_t rowid); uint64_t rowid);
#endif #endif

View File

@ -141,7 +141,8 @@ run (void *cls)
times[i] = GNUNET_TIME_relative_add (times[i], times[i] = GNUNET_TIME_relative_add (times[i],
duration); duration);
duration_sq = duration.rel_value_us * duration.rel_value_us; duration_sq = duration.rel_value_us * duration.rel_value_us;
GNUNET_assert (duration_sq / duration.rel_value_us == duration.rel_value_us); GNUNET_assert (duration_sq / duration.rel_value_us ==
duration.rel_value_us);
GNUNET_assert (sqrs[i] + duration_sq >= sqrs[i]); GNUNET_assert (sqrs[i] + duration_sq >= sqrs[i]);
sqrs[i] += duration_sq; sqrs[i] += duration_sq;
fprintf (stdout, fprintf (stdout,

View File

@ -29,19 +29,17 @@
#include "taler_extensions_policy.h" #include "taler_extensions_policy.h"
struct TALER_EXCHANGEDB_CoinInfo struct TALER_EXCHANGEDB_CoinInfo
{ {
uint64_t *known_coin_id; uint64_t known_coin_id;
struct TALER_DenominationHashP *denom_hash; struct TALER_DenominationHashP denom_hash;
struct TALER_AgeCommitmentHash *h_age_commitment; struct TALER_AgeCommitmentHash h_age_commitment;
bool *existed; bool existed;
bool denom_conflict;
bool age_conflict;
}; };
/** /**
* Information about a denomination key. * Information about a denomination key.
*/ */
@ -900,21 +898,6 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData
}; };
/** /**
* Signature of a function called with information about the exchange's * Signature of a function called with information about the exchange's
* denomination keys. * denomination keys.
@ -4055,10 +4038,10 @@ struct TALER_EXCHANGEDB_Plugin
struct TALER_DenominationHashP *denom_pub_hash, struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_AgeCommitmentHash *age_hash); struct TALER_AgeCommitmentHash *age_hash);
enum TALER_EXCHANGEDB_CoinKnownStatus enum GNUNET_DB_QueryStatus
(*batch_ensure_coin_known)(void *cls, (*batch_ensure_coin_known)(void *cls,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct struct
TALER_EXCHANGEDB_CoinInfo *result, TALER_EXCHANGEDB_CoinInfo *result,
unsigned int coin_length, unsigned int coin_length,
unsigned int batch_size); unsigned int batch_size);