fix exchangedb build errors
This commit is contained in:
parent
9cce35d270
commit
6eed8917c3
@ -116,6 +116,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
|
||||
pg_reserves_in_insert.h pg_reserves_in_insert.c \
|
||||
pg_get_withdraw_info.h pg_get_withdraw_info.c \
|
||||
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_get_policy_details.h pg_get_policy_details.c \
|
||||
pg_persist_policy_details.h pg_persist_policy_details.c \
|
||||
|
@ -36,7 +36,8 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_abort_shard (void *cls,
|
||||
const char *job_name,
|
||||
uint64_t start_row,
|
||||
const char *job_name,
|
||||
uint64_t start_row,
|
||||
uint64_t end_row);
|
||||
|
||||
#endif
|
||||
|
@ -56,8 +56,8 @@ TEH_PG_add_denomination_key (
|
||||
GNUNET_assert (GNUNET_YES ==
|
||||
TALER_denom_fee_check_currency (meta->value.currency,
|
||||
&meta->fees));
|
||||
/* Used in #postgres_insert_denomination_info() and
|
||||
#postgres_add_denomination_key() */
|
||||
/* Used in #postgres_insert_denomination_info() and
|
||||
#postgres_add_denomination_key() */
|
||||
PREPARE (pg,
|
||||
"denomination_insert",
|
||||
"INSERT INTO denominations "
|
||||
@ -86,4 +86,3 @@ TEH_PG_add_denomination_key (
|
||||
"denomination_insert",
|
||||
iparams);
|
||||
}
|
||||
|
||||
|
@ -26,14 +26,10 @@
|
||||
#include "pg_helper.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static enum TALER_EXCHANGEDB_CoinKnownStatus
|
||||
insert1 (struct PosgresClosure *pg,
|
||||
const struct TALER_CoinPublicInfo *coin[1],
|
||||
const struct TALER_EXCHANGEDB_CoinInfo *result[1])
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
insert1 (struct PostgresClosure *pg,
|
||||
const struct TALER_CoinPublicInfo coin[1],
|
||||
struct TALER_EXCHANGEDB_CoinInfo result[1])
|
||||
{
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
bool is_denom_pub_hash_null = false;
|
||||
@ -57,16 +53,16 @@ insert1 (struct PosgresClosure *pg,
|
||||
};
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_bool ("existed",
|
||||
result[0].existed),
|
||||
&result[0].existed),
|
||||
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_auto_from_type ("denom_pub_hash",
|
||||
result[0].denom_hash),
|
||||
&result[0].denom_hash),
|
||||
&is_denom_pub_hash_null),
|
||||
GNUNET_PQ_result_spec_allow_null (
|
||||
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
|
||||
result[0].h_age_commitment),
|
||||
&result[0].h_age_commitment),
|
||||
&is_age_hash_null),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
@ -79,47 +75,47 @@ insert1 (struct PosgresClosure *pg,
|
||||
{
|
||||
case GNUNET_DB_STATUS_HARD_ERROR:
|
||||
GNUNET_break (0);
|
||||
return TALER_EXCHANGEDB_CKS_HARD_FAIL;
|
||||
return qs;
|
||||
case GNUNET_DB_STATUS_SOFT_ERROR:
|
||||
return TALER_EXCHANGEDB_CKS_SOFT_FAIL;
|
||||
return qs;
|
||||
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
|
||||
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:
|
||||
if (! existed)
|
||||
return TALER_EXCHANGEDB_CKS_ADDED;
|
||||
break; /* continued below */
|
||||
}
|
||||
|
||||
if ( (! is_denom_pub_hash_null) &&
|
||||
(0 != GNUNET_memcmp (&denom_hash->hash,
|
||||
&coin->denom_pub_hash.hash)) )
|
||||
(0 != GNUNET_memcmp (&result[0].denom_hash,
|
||||
&coin->denom_pub_hash)) )
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
|
||||
result[0].denom_conflict = true;
|
||||
}
|
||||
|
||||
if ( (! is_age_hash_null) &&
|
||||
(0 != GNUNET_memcmp (h_age_commitment,
|
||||
(0 != GNUNET_memcmp (&result[0].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);
|
||||
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,
|
||||
const struct TALER_CoinPublicInfo *coin[2],
|
||||
const struct TALER_EXCHANGEDB_CoinInfo *result[2])
|
||||
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
insert2 (struct PostgresClosure *pg,
|
||||
const struct TALER_CoinPublicInfo coin[2],
|
||||
struct TALER_EXCHANGEDB_CoinInfo result[2])
|
||||
{
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
bool is_denom_pub_hash_null = false;
|
||||
bool is_age_hash_null = false;
|
||||
bool is_denom_pub_hash_null2 = false;
|
||||
bool is_age_hash_null2 = false;
|
||||
|
||||
PREPARE (pg,
|
||||
"batch2_known_coin",
|
||||
"SELECT"
|
||||
@ -148,21 +144,21 @@ insert2 (struct PosgresClosure *pg,
|
||||
};
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_bool ("existed",
|
||||
result[0].existed),
|
||||
&result[0].existed),
|
||||
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_auto_from_type ("denom_pub_hash",
|
||||
result[0].denom_hash),
|
||||
&result[0].denom_hash),
|
||||
&is_denom_pub_hash_null),
|
||||
GNUNET_PQ_result_spec_allow_null (
|
||||
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),
|
||||
GNUNET_PQ_result_spec_bool ("existed2",
|
||||
result[1].existed),
|
||||
&result[1].existed),
|
||||
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_auto_from_type ("denom_pub_hash2",
|
||||
&result[1].denom_hash),
|
||||
@ -182,57 +178,56 @@ insert2 (struct PosgresClosure *pg,
|
||||
{
|
||||
case GNUNET_DB_STATUS_HARD_ERROR:
|
||||
GNUNET_break (0);
|
||||
return TALER_EXCHANGEDB_CKS_HARD_FAIL;
|
||||
return qs;
|
||||
case GNUNET_DB_STATUS_SOFT_ERROR:
|
||||
return TALER_EXCHANGEDB_CKS_SOFT_FAIL;
|
||||
return qs;
|
||||
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
|
||||
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:
|
||||
if (! existed)
|
||||
return TALER_EXCHANGEDB_CKS_ADDED;
|
||||
break; /* continued below */
|
||||
}
|
||||
|
||||
if ( (! is_denom_pub_hash_null) &&
|
||||
(0 != GNUNET_memcmp (&denom_hash[0].hash,
|
||||
&coin[0].denom_pub_hash.hash)) )
|
||||
(0 != GNUNET_memcmp (&result[0].denom_hash,
|
||||
&coin[0].denom_pub_hash)) )
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
|
||||
result[0].denom_conflict = true;
|
||||
}
|
||||
|
||||
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)) )
|
||||
{
|
||||
GNUNET_break (GNUNET_is_zero (h_age_commitment[0]));
|
||||
GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT;
|
||||
result[0].age_conflict = true;
|
||||
}
|
||||
if ( (! is_denom_pub_hash_null2) &&
|
||||
(0 != GNUNET_memcmp (&denom_hash[1].hash,
|
||||
&coin[1].denom_pub_hash.hash)) )
|
||||
(0 != GNUNET_memcmp (&result[1].denom_hash,
|
||||
&coin[1].denom_pub_hash)) )
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
|
||||
result[1].denom_conflict = true;
|
||||
}
|
||||
|
||||
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)) )
|
||||
{
|
||||
GNUNET_break (GNUNET_is_zero (h_age_commitment[1]));
|
||||
GNUNET_break (GNUNET_is_zero (&result[1].h_age_commitment));
|
||||
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,
|
||||
const struct TALER_CoinPublicInfo *coin[4],
|
||||
const struct TALER_EXCHANGEDB_CoinInfo *result[4])
|
||||
|
||||
static enum GNUNET_DB_QueryStatus
|
||||
insert4 (struct PostgresClosure *pg,
|
||||
const struct TALER_CoinPublicInfo coin[4],
|
||||
struct TALER_EXCHANGEDB_CoinInfo result[4])
|
||||
{
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
bool is_denom_pub_hash_null = false;
|
||||
@ -289,52 +284,52 @@ insert4 (struct PosgresClosure *pg,
|
||||
};
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_bool ("existed",
|
||||
result[0].existed),
|
||||
&result[0].existed),
|
||||
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_auto_from_type ("denom_pub_hash",
|
||||
result[0].denom_hash),
|
||||
&result[0].denom_hash),
|
||||
&is_denom_pub_hash_null),
|
||||
GNUNET_PQ_result_spec_allow_null (
|
||||
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
|
||||
result[0].h_age_commitment),
|
||||
&result[0].h_age_commitment),
|
||||
&is_age_hash_null),
|
||||
GNUNET_PQ_result_spec_bool ("existed2",
|
||||
result[1].existed),
|
||||
&result[1].existed),
|
||||
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_auto_from_type ("denom_pub_hash2",
|
||||
result[1].denom_hash),
|
||||
&result[1].denom_hash),
|
||||
&is_denom_pub_hash_null2),
|
||||
GNUNET_PQ_result_spec_allow_null (
|
||||
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash2",
|
||||
result[1].h_age_commitment),
|
||||
&result[1].h_age_commitment),
|
||||
&is_age_hash_null2),
|
||||
GNUNET_PQ_result_spec_bool ("existed3",
|
||||
result[2].existed),
|
||||
&result[2].existed),
|
||||
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_auto_from_type ("denom_pub_hash3",
|
||||
result[2].denom_hash),
|
||||
&result[2].denom_hash),
|
||||
&is_denom_pub_hash_null3),
|
||||
GNUNET_PQ_result_spec_allow_null (
|
||||
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash3",
|
||||
result[2].h_age_commitment),
|
||||
&result[2].h_age_commitment),
|
||||
&is_age_hash_null3),
|
||||
GNUNET_PQ_result_spec_bool ("existed4",
|
||||
result[3].existed),
|
||||
&result[3].existed),
|
||||
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_auto_from_type ("denom_pub_hash4",
|
||||
result[3].denom_hash),
|
||||
&result[3].denom_hash),
|
||||
&is_denom_pub_hash_null4),
|
||||
GNUNET_PQ_result_spec_allow_null (
|
||||
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash4",
|
||||
result[3].h_age_commitment),
|
||||
&result[3].h_age_commitment),
|
||||
&is_age_hash_null4),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
@ -347,113 +342,105 @@ insert4 (struct PosgresClosure *pg,
|
||||
{
|
||||
case GNUNET_DB_STATUS_HARD_ERROR:
|
||||
GNUNET_break (0);
|
||||
return TALER_EXCHANGEDB_CKS_HARD_FAIL;
|
||||
return qs;
|
||||
case GNUNET_DB_STATUS_SOFT_ERROR:
|
||||
return TALER_EXCHANGEDB_CKS_SOFT_FAIL;
|
||||
return qs;
|
||||
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
|
||||
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:
|
||||
if (! existed)
|
||||
return TALER_EXCHANGEDB_CKS_ADDED;
|
||||
break; /* continued below */
|
||||
}
|
||||
|
||||
if ( (! is_denom_pub_hash_null) &&
|
||||
(0 != GNUNET_memcmp (result[0].denom_hash.hash,
|
||||
&coin[0].denom_pub_hash.hash)) )
|
||||
(0 != GNUNET_memcmp (&result[0].denom_hash,
|
||||
&coin[0].denom_pub_hash)) )
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
|
||||
result[0].denom_conflict = true;
|
||||
}
|
||||
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)) )
|
||||
{
|
||||
GNUNET_break (GNUNET_is_zero (h_age_commitment[0]));
|
||||
GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT;
|
||||
result[0].age_conflict = true;
|
||||
}
|
||||
|
||||
if ( (! is_denom_pub_hash_null2) &&
|
||||
(0 != GNUNET_memcmp (&denom_hash[1].hash,
|
||||
&coin[1].denom_pub_hash.hash)) )
|
||||
(0 != GNUNET_memcmp (&result[1].denom_hash,
|
||||
&coin[1].denom_pub_hash)) )
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
|
||||
result[1].denom_conflict = true;
|
||||
}
|
||||
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)) )
|
||||
{
|
||||
GNUNET_break (GNUNET_is_zero (h_age_commitment[1]));
|
||||
GNUNET_break (GNUNET_is_zero (&result[1].h_age_commitment));
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT;
|
||||
result[1].age_conflict = true;
|
||||
}
|
||||
|
||||
if ( (! is_denom_pub_hash_null3) &&
|
||||
(0 != GNUNET_memcmp (&denom_hash[2].hash,
|
||||
&coin[2].denom_pub_hash.hash)) )
|
||||
(0 != GNUNET_memcmp (&result[2].denom_hash,
|
||||
&coin[2].denom_pub_hash)) )
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
|
||||
result[2].denom_conflict = true;
|
||||
}
|
||||
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)) )
|
||||
{
|
||||
GNUNET_break (GNUNET_is_zero (h_age_commitment[2]));
|
||||
GNUNET_break (GNUNET_is_zero (&result[2].h_age_commitment));
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT;
|
||||
result[2].age_conflict = true;
|
||||
}
|
||||
|
||||
if ( (! is_denom_pub_hash_null4) &&
|
||||
(0 != GNUNET_memcmp (&denom_hash[3].hash,
|
||||
&coin[3].denom_pub_hash.hash)) )
|
||||
(0 != GNUNET_memcmp (&result[3].denom_hash,
|
||||
&coin[3].denom_pub_hash)) )
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
|
||||
result[3].denom_conflict = true;
|
||||
}
|
||||
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)) )
|
||||
{
|
||||
GNUNET_break (GNUNET_is_zero (h_age_commitment[3]));
|
||||
GNUNET_break (GNUNET_is_zero (&result[3].h_age_commitment));
|
||||
GNUNET_break_op (0);
|
||||
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT;
|
||||
result[3].age_conflict = true;
|
||||
}
|
||||
|
||||
return TALER_EXCHANGEDB_CKS_PRESENT;
|
||||
return qs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum TALER_EXCHANGEDB_CoinKnownStatus
|
||||
TEH_PG_batch_ensure_coin_known (void *cls,
|
||||
const struct
|
||||
TALER_CoinPublicInfo *coin,
|
||||
const struct
|
||||
TALER_EXCHANGEDB_CoinInfo *result,
|
||||
unsigned int coin_length,
|
||||
unsigned int batch_size)
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_batch_ensure_coin_known (
|
||||
void *cls,
|
||||
const struct TALER_CoinPublicInfo *coin,
|
||||
struct TALER_EXCHANGEDB_CoinInfo *result,
|
||||
unsigned int coin_length,
|
||||
unsigned int batch_size)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
enum TALER_EXCHANGEDB_CoinKnownStatus qs1;
|
||||
enum TALER_EXCHANGEDB_CoinKnownStatus qs2;
|
||||
enum TALER_EXCHANGEDB_CoinKnownStatus qs4;
|
||||
enum GNUNET_DB_QueryStatus qs = 0;
|
||||
unsigned int i = 0;
|
||||
|
||||
while (i < coin_length)
|
||||
while ( (qs >= 0) &&
|
||||
(i < coin_length) )
|
||||
{
|
||||
unsigned int bs = GNUNET_MIN (batch_size,
|
||||
coin_length - i);
|
||||
bs = 1;
|
||||
if (bs >= 4)
|
||||
{
|
||||
qs4 = insert4 (pg,
|
||||
&coin[i],
|
||||
&result[i]
|
||||
);
|
||||
qs = insert4 (pg,
|
||||
&coin[i],
|
||||
&result[i]);
|
||||
i += 4;
|
||||
continue;
|
||||
}
|
||||
@ -461,17 +448,15 @@ TEH_PG_batch_ensure_coin_known (void *cls,
|
||||
{
|
||||
case 3:
|
||||
case 2:
|
||||
qs2 = insert2 (pg,
|
||||
&coin[i],
|
||||
&result[i]
|
||||
);
|
||||
qs = insert2 (pg,
|
||||
&coin[i],
|
||||
&result[i]);
|
||||
i += 2;
|
||||
break;
|
||||
case 1:
|
||||
qs1 = insert1 (pg,
|
||||
&coin[i],
|
||||
&result[i]
|
||||
);
|
||||
qs = insert1 (pg,
|
||||
&coin[i],
|
||||
&result[i]);
|
||||
i += 1;
|
||||
break;
|
||||
case 0:
|
||||
@ -479,5 +464,7 @@ TEH_PG_batch_ensure_coin_known (void *cls,
|
||||
break;
|
||||
}
|
||||
} /* end while */
|
||||
return TALER_EXCHANGEDB_CKS_PRESENT;
|
||||
if (qs < 0)
|
||||
return qs;
|
||||
return i;
|
||||
}
|
||||
|
@ -24,12 +24,14 @@
|
||||
#include "taler_util.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_exchangedb_plugin.h"
|
||||
enum TALER_EXCHANGEDB_CoinKnownStatus
|
||||
TEH_PG_batch_ensure_coin_known (void *cls,
|
||||
const struct
|
||||
TALER_CoinPublicInfo *coin,
|
||||
const struct
|
||||
TALER_EXCHANGEDB_CoinInfo *result,
|
||||
unsigned int coin_length,
|
||||
unsigned int batch_size);
|
||||
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_batch_ensure_coin_known (
|
||||
void *cls,
|
||||
const struct TALER_CoinPublicInfo *coin,
|
||||
struct TALER_EXCHANGEDB_CoinInfo *result,
|
||||
unsigned int coin_length,
|
||||
unsigned int batch_size);
|
||||
|
||||
#endif
|
||||
|
@ -30,11 +30,11 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_begin_revolving_shard (void *cls,
|
||||
const char *job_name,
|
||||
uint32_t shard_size,
|
||||
uint32_t shard_limit,
|
||||
uint32_t *start_row,
|
||||
uint32_t *end_row)
|
||||
const char *job_name,
|
||||
uint32_t shard_size,
|
||||
uint32_t shard_limit,
|
||||
uint32_t *start_row,
|
||||
uint32_t *end_row)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
|
||||
@ -45,7 +45,7 @@ TEH_PG_begin_revolving_shard (void *cls,
|
||||
{
|
||||
if (GNUNET_OK !=
|
||||
TEH_PG_start (pg,
|
||||
"begin_revolving_shard"))
|
||||
"begin_revolving_shard"))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
@ -64,15 +64,15 @@ TEH_PG_begin_revolving_shard (void *cls,
|
||||
&last_end),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
/* Used in #postgres_begin_revolving_shard() */
|
||||
PREPARE(pg,
|
||||
"get_last_revolving_shard",
|
||||
"SELECT"
|
||||
" end_row"
|
||||
" FROM revolving_work_shards"
|
||||
" WHERE job_name=$1"
|
||||
" ORDER BY end_row DESC"
|
||||
" LIMIT 1;");
|
||||
/* Used in #postgres_begin_revolving_shard() */
|
||||
PREPARE (pg,
|
||||
"get_last_revolving_shard",
|
||||
"SELECT"
|
||||
" end_row"
|
||||
" FROM revolving_work_shards"
|
||||
" WHERE job_name=$1"
|
||||
" ORDER BY end_row DESC"
|
||||
" LIMIT 1;");
|
||||
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"get_last_revolving_shard",
|
||||
params,
|
||||
@ -116,7 +116,7 @@ TEH_PG_begin_revolving_shard (void *cls,
|
||||
(unsigned long long) *start_row,
|
||||
(unsigned long long) *end_row);
|
||||
|
||||
/* Used in #postgres_claim_revolving_shard() */
|
||||
/* Used in #postgres_claim_revolving_shard() */
|
||||
PREPARE (pg,
|
||||
"create_revolving_shard",
|
||||
"INSERT INTO revolving_work_shards"
|
||||
@ -164,7 +164,7 @@ TEH_PG_begin_revolving_shard (void *cls,
|
||||
end_row),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
/* Used in #postgres_begin_revolving_shard() */
|
||||
/* Used in #postgres_begin_revolving_shard() */
|
||||
PREPARE (pg,
|
||||
"get_open_revolving_shard",
|
||||
"SELECT"
|
||||
@ -206,7 +206,7 @@ TEH_PG_begin_revolving_shard (void *cls,
|
||||
|
||||
now = GNUNET_TIME_timestamp_get ();
|
||||
|
||||
/* Used in #postgres_begin_revolving_shard() */
|
||||
/* Used in #postgres_begin_revolving_shard() */
|
||||
PREPARE (pg,
|
||||
"reclaim_revolving_shard",
|
||||
"UPDATE revolving_work_shards"
|
||||
|
@ -40,9 +40,10 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_begin_revolving_shard (void *cls,
|
||||
const char *job_name,
|
||||
uint32_t shard_size,
|
||||
uint32_t shard_limit,
|
||||
uint32_t *start_row,
|
||||
const char *job_name,
|
||||
uint32_t shard_size,
|
||||
uint32_t shard_limit,
|
||||
uint32_t *start_row,
|
||||
uint32_t *end_row);
|
||||
|
||||
#endif
|
||||
|
@ -38,10 +38,10 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_begin_shard (void *cls,
|
||||
const char *job_name,
|
||||
struct GNUNET_TIME_Relative delay,
|
||||
uint64_t shard_size,
|
||||
uint64_t *start_row,
|
||||
const char *job_name,
|
||||
struct GNUNET_TIME_Relative delay,
|
||||
uint64_t shard_size,
|
||||
uint64_t *start_row,
|
||||
uint64_t *end_row);
|
||||
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@ TEH_PG_commit (void *cls)
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Committing transaction `%s'\n",
|
||||
pg->transaction_name);
|
||||
/* used in #postgres_commit */
|
||||
/* used in #postgres_commit */
|
||||
PREPARE (pg,
|
||||
"do_commit",
|
||||
"COMMIT");
|
||||
|
@ -36,7 +36,8 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_complete_shard (void *cls,
|
||||
const char *job_name,
|
||||
uint64_t start_row,
|
||||
const char *job_name,
|
||||
uint64_t start_row,
|
||||
uint64_t end_row);
|
||||
|
||||
#endif
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
long long
|
||||
TEH_PG_count_known_coins (void *cls,
|
||||
const struct
|
||||
TALER_DenominationHashP *denom_pub_hash)
|
||||
const struct
|
||||
TALER_DenominationHashP *denom_pub_hash)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
uint64_t count;
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
long long
|
||||
TEH_PG_count_known_coins (void *cls,
|
||||
const struct
|
||||
const struct
|
||||
TALER_DenominationHashP *denom_pub_hash);
|
||||
|
||||
#endif
|
||||
|
@ -46,18 +46,18 @@ TEH_PG_create_aggregation_transient (
|
||||
GNUNET_PQ_query_param_auto_from_type (wtid),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
/* Used in #postgres_create_aggregation_transient() */
|
||||
/* Used in #postgres_create_aggregation_transient() */
|
||||
PREPARE (pg,
|
||||
"create_aggregation_transient",
|
||||
"INSERT INTO aggregation_transient"
|
||||
" (amount_val"
|
||||
" ,amount_frac"
|
||||
" ,merchant_pub"
|
||||
" ,wire_target_h_payto"
|
||||
" ,legitimization_requirement_serial_id"
|
||||
" ,exchange_account_section"
|
||||
" ,wtid_raw)"
|
||||
" VALUES ($1, $2, $3, $4, $5, $6, $7);");
|
||||
"create_aggregation_transient",
|
||||
"INSERT INTO aggregation_transient"
|
||||
" (amount_val"
|
||||
" ,amount_frac"
|
||||
" ,merchant_pub"
|
||||
" ,wire_target_h_payto"
|
||||
" ,legitimization_requirement_serial_id"
|
||||
" ,exchange_account_section"
|
||||
" ,wtid_raw)"
|
||||
" VALUES ($1, $2, $3, $4, $5, $6, $7);");
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"create_aggregation_transient",
|
||||
params);
|
||||
|
@ -48,5 +48,3 @@ TEH_PG_delete_aggregation_transient (
|
||||
"delete_aggregation_transient",
|
||||
params);
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,4 +39,3 @@ TEH_PG_delete_shard_locks (void *cls)
|
||||
return GNUNET_PQ_exec_statements (pg->conn,
|
||||
es);
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,8 @@ TEH_PG_do_batch_withdraw (
|
||||
pg->legal_reserve_expiration_time));
|
||||
|
||||
|
||||
/* Used in #postgres_do_batch_withdraw() to
|
||||
update the reserve balance and check its status */
|
||||
/* Used in #postgres_do_batch_withdraw() to
|
||||
update the reserve balance and check its status */
|
||||
PREPARE (pg,
|
||||
"call_batch_withdraw",
|
||||
"SELECT "
|
||||
@ -75,4 +75,3 @@ TEH_PG_do_batch_withdraw (
|
||||
params,
|
||||
rs);
|
||||
}
|
||||
|
||||
|
@ -59,9 +59,9 @@ TEH_PG_do_batch_withdraw_insert (
|
||||
nonce_reuse),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
/* Used in #postgres_do_batch_withdraw_insert() to store
|
||||
the signature of a blinded coin with the blinded coin's
|
||||
details. */
|
||||
/* Used in #postgres_do_batch_withdraw_insert() to store
|
||||
the signature of a blinded coin with the blinded coin's
|
||||
details. */
|
||||
PREPARE (pg,
|
||||
"call_batch_withdraw_insert",
|
||||
"SELECT "
|
||||
|
@ -69,8 +69,8 @@ TEH_PG_do_deposit (
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
/* Used in #postgres_do_deposit() to execute a deposit,
|
||||
checking the coin's balance in the process as needed. */
|
||||
/* Used in #postgres_do_deposit() to execute a deposit,
|
||||
checking the coin's balance in the process as needed. */
|
||||
PREPARE (pg,
|
||||
"call_deposit",
|
||||
"SELECT "
|
||||
|
@ -63,7 +63,7 @@ TEH_PG_do_melt (
|
||||
};
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
|
||||
/* Used in #postgres_do_melt() to melt a coin. */
|
||||
/* Used in #postgres_do_melt() to melt a coin. */
|
||||
PREPARE (pg,
|
||||
"call_melt",
|
||||
"SELECT "
|
||||
|
@ -75,7 +75,7 @@ TEH_PG_do_purse_merge (
|
||||
&h_payto);
|
||||
GNUNET_free (payto_uri);
|
||||
}
|
||||
/* Used in #postgres_do_purse_merge() */
|
||||
/* Used in #postgres_do_purse_merge() */
|
||||
PREPARE (pg,
|
||||
"call_purse_merge",
|
||||
"SELECT"
|
||||
|
@ -70,7 +70,6 @@ TEH_PG_do_recoup (
|
||||
};
|
||||
|
||||
|
||||
|
||||
PREPARE (pg,
|
||||
"call_recoup",
|
||||
"SELECT "
|
||||
|
@ -53,4 +53,5 @@ TEH_PG_do_recoup_refresh (
|
||||
struct GNUNET_TIME_Timestamp *recoup_timestamp,
|
||||
bool *recoup_ok,
|
||||
bool *internal_failure);
|
||||
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ TEH_PG_do_refund (
|
||||
GNUNET_break (0);
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
}
|
||||
/* Used in #postgres_do_refund() to refund a deposit. */
|
||||
/* Used in #postgres_do_refund() to refund a deposit. */
|
||||
PREPARE (pg,
|
||||
"call_refund",
|
||||
"SELECT "
|
||||
|
@ -82,5 +82,3 @@ TEH_PG_do_withdraw (
|
||||
params,
|
||||
rs);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_drain_kyc_alert (void *cls,
|
||||
uint32_t trigger_type,
|
||||
struct TALER_PaytoHashP *h_payto)
|
||||
uint32_t trigger_type,
|
||||
struct TALER_PaytoHashP *h_payto)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
|
@ -34,7 +34,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_drain_kyc_alert (void *cls,
|
||||
uint32_t trigger_type,
|
||||
uint32_t trigger_type,
|
||||
struct TALER_PaytoHashP *h_payto);
|
||||
|
||||
#endif
|
||||
|
@ -28,10 +28,10 @@
|
||||
|
||||
enum TALER_EXCHANGEDB_CoinKnownStatus
|
||||
TEH_PG_ensure_coin_known (void *cls,
|
||||
const struct TALER_CoinPublicInfo *coin,
|
||||
uint64_t *known_coin_id,
|
||||
struct TALER_DenominationHashP *denom_hash,
|
||||
struct TALER_AgeCommitmentHash *h_age_commitment)
|
||||
const struct TALER_CoinPublicInfo *coin,
|
||||
uint64_t *known_coin_id,
|
||||
struct TALER_DenominationHashP *denom_hash,
|
||||
struct TALER_AgeCommitmentHash *h_age_commitment)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
|
@ -37,9 +37,9 @@
|
||||
*/
|
||||
enum TALER_EXCHANGEDB_CoinKnownStatus
|
||||
TEH_PG_ensure_coin_known (void *cls,
|
||||
const struct TALER_CoinPublicInfo *coin,
|
||||
uint64_t *known_coin_id,
|
||||
struct TALER_DenominationHashP *denom_hash,
|
||||
const struct TALER_CoinPublicInfo *coin,
|
||||
uint64_t *known_coin_id,
|
||||
struct TALER_DenominationHashP *denom_hash,
|
||||
struct TALER_AgeCommitmentHash *h_age_commitment);
|
||||
|
||||
#endif
|
||||
|
@ -38,10 +38,10 @@
|
||||
*/
|
||||
struct GNUNET_DB_EventHandler *
|
||||
TEH_PG_event_listen (void *cls,
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
GNUNET_DB_EventCallback cb,
|
||||
void *cb_cls)
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
GNUNET_DB_EventCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
|
||||
|
@ -37,9 +37,9 @@
|
||||
*/
|
||||
struct GNUNET_DB_EventHandler *
|
||||
TEH_PG_event_listen (void *cls,
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
GNUNET_DB_EventCallback cb,
|
||||
struct GNUNET_TIME_Relative timeout,
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
GNUNET_DB_EventCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -26,10 +26,9 @@
|
||||
#include "pg_helper.h"
|
||||
|
||||
|
||||
|
||||
void
|
||||
TEH_PG_event_listen_cancel (void *cls,
|
||||
struct GNUNET_DB_EventHandler *eh)
|
||||
struct GNUNET_DB_EventHandler *eh)
|
||||
|
||||
{
|
||||
(void) cls;
|
||||
|
@ -28,9 +28,9 @@
|
||||
|
||||
void
|
||||
TEH_PG_event_notify (void *cls,
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
const void *extra,
|
||||
size_t extra_size)
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
const void *extra,
|
||||
size_t extra_size)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
|
||||
|
@ -35,8 +35,8 @@
|
||||
*/
|
||||
void
|
||||
TEH_PG_event_notify (void *cls,
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
const void *extra,
|
||||
const struct GNUNET_DB_EventHeaderP *es,
|
||||
const void *extra,
|
||||
size_t extra_size);
|
||||
|
||||
#endif
|
||||
|
@ -128,7 +128,7 @@ TEH_PG_find_aggregation_transient (
|
||||
.pg = pg,
|
||||
.status = GNUNET_OK
|
||||
};
|
||||
/* Used in #postgres_find_aggregation_transient() */
|
||||
/* Used in #postgres_find_aggregation_transient() */
|
||||
PREPARE (pg,
|
||||
"find_transient_aggregations",
|
||||
"SELECT"
|
||||
|
@ -35,4 +35,5 @@
|
||||
*/
|
||||
enum GNUNET_GenericReturnValue
|
||||
TEH_PG_gc (void *cls);
|
||||
|
||||
#endif
|
||||
|
@ -49,9 +49,9 @@ TEH_PG_get_coin_denomination (
|
||||
"Getting coin denomination of coin %s\n",
|
||||
TALER_B2S (coin_pub));
|
||||
|
||||
/* Used in #postgres_get_coin_denomination() to fetch
|
||||
the denomination public key hash for
|
||||
a coin known to the exchange. */
|
||||
/* Used in #postgres_get_coin_denomination() to fetch
|
||||
the denomination public key hash for
|
||||
a coin known to the exchange. */
|
||||
PREPARE (pg,
|
||||
"get_coin_denomination",
|
||||
"SELECT"
|
||||
@ -67,5 +67,3 @@ TEH_PG_get_coin_denomination (
|
||||
params,
|
||||
rs);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,15 +46,15 @@ TEH_PG_get_denomination_revocation (
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"denomination_revocation_get",
|
||||
"SELECT"
|
||||
" master_sig"
|
||||
",denom_revocations_serial_id"
|
||||
" FROM denomination_revocations"
|
||||
" WHERE denominations_serial="
|
||||
" (SELECT denominations_serial"
|
||||
" FROM denominations"
|
||||
" WHERE denom_pub_hash=$1);");
|
||||
"denomination_revocation_get",
|
||||
"SELECT"
|
||||
" master_sig"
|
||||
",denom_revocations_serial_id"
|
||||
" FROM denomination_revocations"
|
||||
" WHERE denominations_serial="
|
||||
" (SELECT denominations_serial"
|
||||
" FROM denominations"
|
||||
" WHERE denom_pub_hash=$1);");
|
||||
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"denomination_revocation_get",
|
||||
|
@ -41,4 +41,5 @@ TEH_PG_get_denomination_revocation (
|
||||
const struct TALER_DenominationHashP *denom_pub_hash,
|
||||
struct TALER_MasterSignatureP *master_sig,
|
||||
uint64_t *rowid);
|
||||
|
||||
#endif
|
||||
|
@ -36,6 +36,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_extension_manifest (void *cls,
|
||||
const char *extension_name,
|
||||
const char *extension_name,
|
||||
char **manifest);
|
||||
|
||||
#endif
|
||||
|
@ -28,14 +28,14 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_global_fee (void *cls,
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative *purse_timeout,
|
||||
struct GNUNET_TIME_Relative *history_expiration,
|
||||
uint32_t *purse_account_limit,
|
||||
struct TALER_MasterSignatureP *master_sig)
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative *purse_timeout,
|
||||
struct GNUNET_TIME_Relative *history_expiration,
|
||||
uint32_t *purse_account_limit,
|
||||
struct TALER_MasterSignatureP *master_sig)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -65,25 +65,25 @@ TEH_PG_get_global_fee (void *cls,
|
||||
};
|
||||
|
||||
|
||||
/* Used in #postgres_get_global_fee() */
|
||||
PREPARE(pg,
|
||||
"get_global_fee",
|
||||
"SELECT "
|
||||
" start_date"
|
||||
",end_date"
|
||||
",history_fee_val"
|
||||
",history_fee_frac"
|
||||
",account_fee_val"
|
||||
",account_fee_frac"
|
||||
",purse_fee_val"
|
||||
",purse_fee_frac"
|
||||
",purse_timeout"
|
||||
",history_expiration"
|
||||
",purse_account_limit"
|
||||
",master_sig"
|
||||
" FROM global_fee"
|
||||
" WHERE start_date <= $1"
|
||||
" AND end_date > $1;");
|
||||
/* Used in #postgres_get_global_fee() */
|
||||
PREPARE (pg,
|
||||
"get_global_fee",
|
||||
"SELECT "
|
||||
" start_date"
|
||||
",end_date"
|
||||
",history_fee_val"
|
||||
",history_fee_frac"
|
||||
",account_fee_val"
|
||||
",account_fee_frac"
|
||||
",purse_fee_val"
|
||||
",purse_fee_frac"
|
||||
",purse_timeout"
|
||||
",history_expiration"
|
||||
",purse_account_limit"
|
||||
",master_sig"
|
||||
" FROM global_fee"
|
||||
" WHERE start_date <= $1"
|
||||
" AND end_date > $1;");
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"get_global_fee",
|
||||
params,
|
||||
|
@ -40,13 +40,13 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_global_fee (void *cls,
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative *purse_timeout,
|
||||
struct GNUNET_TIME_Relative *history_expiration,
|
||||
uint32_t *purse_account_limit,
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative *purse_timeout,
|
||||
struct GNUNET_TIME_Relative *history_expiration,
|
||||
uint32_t *purse_account_limit,
|
||||
struct TALER_MasterSignatureP *master_sig);
|
||||
|
||||
#endif
|
||||
|
@ -121,11 +121,10 @@ global_fees_cb (void *cls,
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_global_fees (void *cls,
|
||||
TALER_EXCHANGEDB_GlobalFeeCallback cb,
|
||||
void *cb_cls)
|
||||
TALER_EXCHANGEDB_GlobalFeeCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_TIME_Timestamp date
|
||||
@ -144,7 +143,7 @@ TEH_PG_get_global_fees (void *cls,
|
||||
.status = GNUNET_OK
|
||||
};
|
||||
|
||||
/* Used in #postgres_get_global_fees() */
|
||||
/* Used in #postgres_get_global_fees() */
|
||||
PREPARE (pg,
|
||||
"get_global_fees",
|
||||
"SELECT "
|
||||
@ -169,7 +168,3 @@ TEH_PG_get_global_fees (void *cls,
|
||||
&global_fees_cb,
|
||||
&gctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_global_fees (void *cls,
|
||||
TALER_EXCHANGEDB_GlobalFeeCallback cb,
|
||||
TALER_EXCHANGEDB_GlobalFeeCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_known_coin (void *cls,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
struct TALER_CoinPublicInfo *coin_info)
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
struct TALER_CoinPublicInfo *coin_info)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -51,9 +51,9 @@ TEH_PG_get_known_coin (void *cls,
|
||||
"Getting known coin data for coin %s\n",
|
||||
TALER_B2S (coin_pub));
|
||||
coin_info->coin_pub = *coin_pub;
|
||||
/* Used in #postgres_get_known_coin() to fetch
|
||||
the denomination public key and signature for
|
||||
a coin known to the exchange. */
|
||||
/* Used in #postgres_get_known_coin() to fetch
|
||||
the denomination public key and signature for
|
||||
a coin known to the exchange. */
|
||||
PREPARE (pg,
|
||||
"get_known_coin",
|
||||
"SELECT"
|
||||
|
@ -34,7 +34,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_known_coin (void *cls,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
struct TALER_CoinPublicInfo *coin_info);
|
||||
|
||||
#endif
|
||||
|
@ -28,9 +28,9 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_melt (void *cls,
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
struct TALER_EXCHANGEDB_Melt *melt,
|
||||
uint64_t *melt_serial_id)
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
struct TALER_EXCHANGEDB_Melt *melt,
|
||||
uint64_t *melt_serial_id)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
bool h_age_commitment_is_null;
|
||||
@ -66,8 +66,8 @@ TEH_PG_get_melt (void *cls,
|
||||
0,
|
||||
sizeof (melt->session.coin.denom_sig));
|
||||
|
||||
/* Used in #postgres_get_melt() to fetch
|
||||
high-level information about a melt operation */
|
||||
/* Used in #postgres_get_melt() to fetch
|
||||
high-level information about a melt operation */
|
||||
PREPARE (pg,
|
||||
"get_melt",
|
||||
/* "SELECT"
|
||||
|
@ -37,8 +37,8 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_melt (void *cls,
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
struct TALER_EXCHANGEDB_Melt *melt,
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
struct TALER_EXCHANGEDB_Melt *melt,
|
||||
uint64_t *melt_serial_id);
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "pg_helper.h"
|
||||
|
||||
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_old_coin_by_h_blind (
|
||||
void *cls,
|
||||
@ -47,7 +46,7 @@ TEH_PG_get_old_coin_by_h_blind (
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
/* Used in #postgres_get_old_coin_by_h_blind() */
|
||||
/* Used in #postgres_get_old_coin_by_h_blind() */
|
||||
PREPARE (pg,
|
||||
"old_coin_by_h_blind",
|
||||
"SELECT"
|
||||
|
@ -41,4 +41,5 @@ TEH_PG_get_old_coin_by_h_blind (
|
||||
const struct TALER_BlindedCoinHashP *h_blind_ev,
|
||||
struct TALER_CoinSpendPublicKeyP *old_coin_pub,
|
||||
uint64_t *rrc_serial);
|
||||
|
||||
#endif
|
||||
|
@ -57,7 +57,6 @@ TEH_PG_get_policy_details (
|
||||
};
|
||||
|
||||
|
||||
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"get_policy_details",
|
||||
params,
|
||||
|
@ -61,7 +61,7 @@ TEH_PG_get_purse_deposit (
|
||||
|
||||
|
||||
*partner_url = NULL;
|
||||
/* Used in #postgres_get_purse_deposit */
|
||||
/* Used in #postgres_get_purse_deposit */
|
||||
PREPARE (pg,
|
||||
"select_purse_deposit_by_coin_pub",
|
||||
"SELECT "
|
||||
|
@ -80,4 +80,3 @@ TEH_PG_get_purse_request (
|
||||
params,
|
||||
rs);
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,9 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_ready_deposit (void *cls,
|
||||
uint64_t start_shard_row,
|
||||
uint64_t end_shard_row,
|
||||
struct TALER_MerchantPublicKeyP *merchant_pub,
|
||||
uint64_t start_shard_row,
|
||||
uint64_t end_shard_row,
|
||||
struct TALER_MerchantPublicKeyP *merchant_pub,
|
||||
char **payto_uri);
|
||||
|
||||
#endif
|
||||
|
@ -133,14 +133,11 @@ add_revealed_coins (void *cls,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_refresh_reveal (void *cls,
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
TALER_EXCHANGEDB_RefreshCallback cb,
|
||||
void *cb_cls)
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
TALER_EXCHANGEDB_RefreshCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GetRevealContext grctx;
|
||||
@ -154,8 +151,8 @@ TEH_PG_get_refresh_reveal (void *cls,
|
||||
0,
|
||||
sizeof (grctx));
|
||||
|
||||
/* Obtain information about the coins created in a refresh
|
||||
operation, used in #postgres_get_refresh_reveal() */
|
||||
/* Obtain information about the coins created in a refresh
|
||||
operation, used in #postgres_get_refresh_reveal() */
|
||||
PREPARE (pg,
|
||||
"get_refresh_revealed_coins",
|
||||
"SELECT "
|
||||
|
@ -37,8 +37,8 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_refresh_reveal (void *cls,
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
TALER_EXCHANGEDB_RefreshCallback cb,
|
||||
const struct TALER_RefreshCommitmentP *rc,
|
||||
TALER_EXCHANGEDB_RefreshCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_reserve_balance (void *cls,
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
struct TALER_Amount *balance)
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
struct TALER_Amount *balance)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
|
@ -34,7 +34,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_reserve_balance (void *cls,
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
struct TALER_Amount *balance);
|
||||
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@ TEH_PG_get_reserve_by_h_blind (
|
||||
reserve_out_serial_id),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
/* Used in #postgres_get_reserve_by_h_blind() */
|
||||
/* Used in #postgres_get_reserve_by_h_blind() */
|
||||
PREPARE (pg,
|
||||
"reserve_by_h_blind",
|
||||
"SELECT"
|
||||
|
@ -92,12 +92,10 @@ get_wire_accounts_cb (void *cls,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_wire_accounts (void *cls,
|
||||
TALER_EXCHANGEDB_WireAccountCallback cb,
|
||||
void *cb_cls)
|
||||
TALER_EXCHANGEDB_WireAccountCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GetWireAccountsContext ctx = {
|
||||
@ -111,12 +109,12 @@ TEH_PG_get_wire_accounts (void *cls,
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
|
||||
PREPARE (pg,
|
||||
"get_wire_accounts",
|
||||
"SELECT"
|
||||
" payto_uri"
|
||||
",master_sig"
|
||||
" FROM wire_accounts"
|
||||
" WHERE is_active");
|
||||
"get_wire_accounts",
|
||||
"SELECT"
|
||||
" payto_uri"
|
||||
",master_sig"
|
||||
" FROM wire_accounts"
|
||||
" WHERE is_active");
|
||||
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
|
||||
"get_wire_accounts",
|
||||
params,
|
||||
|
@ -36,7 +36,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_wire_accounts (void *cls,
|
||||
TALER_EXCHANGEDB_WireAccountCallback cb,
|
||||
TALER_EXCHANGEDB_WireAccountCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -27,12 +27,12 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_wire_fee (void *cls,
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_WireFeeSet *fees,
|
||||
struct TALER_MasterSignatureP *master_sig)
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_WireFeeSet *fees,
|
||||
struct TALER_MasterSignatureP *master_sig)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -55,22 +55,21 @@ TEH_PG_get_wire_fee (void *cls,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Used in #postgres_get_wire_fee() */
|
||||
PREPARE(pg,
|
||||
"get_wire_fee",
|
||||
"SELECT "
|
||||
" start_date"
|
||||
",end_date"
|
||||
",wire_fee_val"
|
||||
",wire_fee_frac"
|
||||
",closing_fee_val"
|
||||
",closing_fee_frac"
|
||||
",master_sig"
|
||||
" FROM wire_fee"
|
||||
" WHERE wire_method=$1"
|
||||
" AND start_date <= $2"
|
||||
" AND end_date > $2;");
|
||||
/* Used in #postgres_get_wire_fee() */
|
||||
PREPARE (pg,
|
||||
"get_wire_fee",
|
||||
"SELECT "
|
||||
" start_date"
|
||||
",end_date"
|
||||
",wire_fee_val"
|
||||
",wire_fee_frac"
|
||||
",closing_fee_val"
|
||||
",closing_fee_frac"
|
||||
",master_sig"
|
||||
" FROM wire_fee"
|
||||
" WHERE wire_method=$1"
|
||||
" AND start_date <= $2"
|
||||
" AND end_date > $2;");
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"get_wire_fee",
|
||||
params,
|
||||
|
@ -39,11 +39,11 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_wire_fee (void *cls,
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_WireFeeSet *fees,
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp date,
|
||||
struct GNUNET_TIME_Timestamp *start_date,
|
||||
struct GNUNET_TIME_Timestamp *end_date,
|
||||
struct TALER_WireFeeSet *fees,
|
||||
struct TALER_MasterSignatureP *master_sig);
|
||||
|
||||
#endif
|
||||
|
@ -109,9 +109,9 @@ get_wire_fees_cb (void *cls,
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_wire_fees (void *cls,
|
||||
const char *wire_method,
|
||||
TALER_EXCHANGEDB_WireFeeCallback cb,
|
||||
void *cb_cls)
|
||||
const char *wire_method,
|
||||
TALER_EXCHANGEDB_WireFeeCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
|
@ -37,8 +37,8 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_get_wire_fees (void *cls,
|
||||
const char *wire_method,
|
||||
TALER_EXCHANGEDB_WireFeeCallback cb,
|
||||
const char *wire_method,
|
||||
TALER_EXCHANGEDB_WireFeeCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -55,10 +55,10 @@ TEH_PG_get_withdraw_info (
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
/* Used in #postgres_get_withdraw_info() to
|
||||
locate the response for a /reserve/withdraw request
|
||||
using the hash of the blinded message. Used to
|
||||
make sure /reserve/withdraw requests are idempotent. */
|
||||
/* Used in #postgres_get_withdraw_info() to
|
||||
locate the response for a /reserve/withdraw request
|
||||
using the hash of the blinded message. Used to
|
||||
make sure /reserve/withdraw requests are idempotent. */
|
||||
PREPARE (pg,
|
||||
"get_withdraw_info",
|
||||
"SELECT"
|
||||
|
@ -71,29 +71,29 @@ TEH_PG_have_deposit2 (
|
||||
"Getting deposits for coin %s\n",
|
||||
TALER_B2S (coin_pub));
|
||||
|
||||
/* Fetch an existing deposit request, used to ensure idempotency
|
||||
during /deposit processing. Used in #postgres_have_deposit(). */
|
||||
/* Fetch an existing deposit request, used to ensure idempotency
|
||||
during /deposit processing. Used in #postgres_have_deposit(). */
|
||||
PREPARE (pg,
|
||||
"get_deposit",
|
||||
"SELECT"
|
||||
" dep.amount_with_fee_val"
|
||||
",dep.amount_with_fee_frac"
|
||||
",denominations.fee_deposit_val"
|
||||
",denominations.fee_deposit_frac"
|
||||
",dep.wallet_timestamp"
|
||||
",dep.exchange_timestamp"
|
||||
",dep.refund_deadline"
|
||||
",dep.wire_deadline"
|
||||
",dep.h_contract_terms"
|
||||
",dep.wire_salt"
|
||||
",wt.payto_uri AS receiver_wire_account"
|
||||
" FROM deposits dep"
|
||||
" JOIN known_coins kc ON (kc.coin_pub = dep.coin_pub)"
|
||||
" JOIN denominations USING (denominations_serial)"
|
||||
" JOIN wire_targets wt USING (wire_target_h_payto)"
|
||||
" WHERE dep.coin_pub=$1"
|
||||
" AND dep.merchant_pub=$3"
|
||||
" AND dep.h_contract_terms=$2;");
|
||||
"get_deposit",
|
||||
"SELECT"
|
||||
" dep.amount_with_fee_val"
|
||||
",dep.amount_with_fee_frac"
|
||||
",denominations.fee_deposit_val"
|
||||
",denominations.fee_deposit_frac"
|
||||
",dep.wallet_timestamp"
|
||||
",dep.exchange_timestamp"
|
||||
",dep.refund_deadline"
|
||||
",dep.wire_deadline"
|
||||
",dep.h_contract_terms"
|
||||
",dep.wire_salt"
|
||||
",wt.payto_uri AS receiver_wire_account"
|
||||
" FROM deposits dep"
|
||||
" JOIN known_coins kc ON (kc.coin_pub = dep.coin_pub)"
|
||||
" JOIN denominations USING (denominations_serial)"
|
||||
" JOIN wire_targets wt USING (wire_target_h_payto)"
|
||||
" WHERE dep.coin_pub=$1"
|
||||
" AND dep.merchant_pub=$3"
|
||||
" AND dep.h_contract_terms=$2;");
|
||||
|
||||
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"get_deposit",
|
||||
|
@ -51,4 +51,3 @@ TEH_PG_insert_aggregation_tracking (
|
||||
"insert_aggregation_tracking",
|
||||
params);
|
||||
}
|
||||
|
||||
|
@ -40,4 +40,3 @@ TEH_PG_insert_aggregation_tracking (
|
||||
unsigned long long deposit_serial_id);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -27,10 +27,10 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_auditor (void *cls,
|
||||
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
||||
const char *auditor_url,
|
||||
const char *auditor_name,
|
||||
struct GNUNET_TIME_Timestamp start_date)
|
||||
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
||||
const char *auditor_url,
|
||||
const char *auditor_name,
|
||||
struct GNUNET_TIME_Timestamp start_date)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -41,7 +41,7 @@ TEH_PG_insert_auditor (void *cls,
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
/* used in #postgres_insert_auditor() */
|
||||
/* used in #postgres_insert_auditor() */
|
||||
PREPARE (pg,
|
||||
"insert_auditor",
|
||||
"INSERT INTO auditors "
|
||||
|
@ -38,8 +38,8 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_auditor (void *cls,
|
||||
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
||||
const char *auditor_url,
|
||||
const char *auditor_name,
|
||||
const struct TALER_AuditorPublicKeyP *auditor_pub,
|
||||
const char *auditor_url,
|
||||
const char *auditor_name,
|
||||
struct GNUNET_TIME_Timestamp start_date);
|
||||
#endif
|
||||
|
@ -45,20 +45,20 @@ TEH_PG_insert_contract (
|
||||
};
|
||||
|
||||
*in_conflict = false;
|
||||
/* Used in #postgres_insert_contract() */
|
||||
/* Used in #postgres_insert_contract() */
|
||||
PREPARE (pg,
|
||||
"insert_contract",
|
||||
"INSERT INTO contracts"
|
||||
" (purse_pub"
|
||||
" ,pub_ckey"
|
||||
" ,e_contract"
|
||||
" ,contract_sig"
|
||||
" ,purse_expiration"
|
||||
" ) SELECT "
|
||||
" $1, $2, $3, $4, purse_expiration"
|
||||
" FROM purse_requests"
|
||||
" WHERE purse_pub=$1"
|
||||
" ON CONFLICT DO NOTHING;");
|
||||
"insert_contract",
|
||||
"INSERT INTO contracts"
|
||||
" (purse_pub"
|
||||
" ,pub_ckey"
|
||||
" ,e_contract"
|
||||
" ,contract_sig"
|
||||
" ,purse_expiration"
|
||||
" ) SELECT "
|
||||
" $1, $2, $3, $4, purse_expiration"
|
||||
" FROM purse_requests"
|
||||
" WHERE purse_pub=$1"
|
||||
" ON CONFLICT DO NOTHING;");
|
||||
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"insert_contract",
|
||||
params);
|
||||
@ -68,8 +68,8 @@ TEH_PG_insert_contract (
|
||||
struct TALER_EncryptedContract econtract2;
|
||||
|
||||
qs = TEH_PG_select_contract_by_purse (pg,
|
||||
purse_pub,
|
||||
&econtract2);
|
||||
purse_pub,
|
||||
&econtract2);
|
||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
|
@ -39,7 +39,7 @@ TEH_PG_insert_denomination_revocation (
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
/* Used in #postgres_insert_denomination_revocation() */
|
||||
/* Used in #postgres_insert_denomination_revocation() */
|
||||
PREPARE (pg,
|
||||
"denomination_revocation_insert",
|
||||
"INSERT INTO denomination_revocations "
|
||||
|
@ -34,7 +34,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_deposit (void *cls,
|
||||
struct GNUNET_TIME_Timestamp exchange_timestamp,
|
||||
struct GNUNET_TIME_Timestamp exchange_timestamp,
|
||||
const struct TALER_EXCHANGEDB_Deposit *deposit);
|
||||
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@ TEH_PG_insert_drain_profit (
|
||||
GNUNET_PQ_query_param_auto_from_type (master_sig),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
/* Used in #postgres_insert_drain_profit() */
|
||||
/* Used in #postgres_insert_drain_profit() */
|
||||
PREPARE (pg,
|
||||
"drain_profit_insert",
|
||||
"INSERT INTO profit_drains "
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_global_fee (void *cls,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative purse_timeout,
|
||||
struct GNUNET_TIME_Relative history_expiration,
|
||||
uint32_t purse_account_limit,
|
||||
const struct TALER_MasterSignatureP *master_sig)
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative purse_timeout,
|
||||
struct GNUNET_TIME_Relative history_expiration,
|
||||
uint32_t purse_account_limit,
|
||||
const struct TALER_MasterSignatureP *master_sig)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -59,14 +59,14 @@ TEH_PG_insert_global_fee (void *cls,
|
||||
uint32_t pal;
|
||||
|
||||
qs = TEH_PG_get_global_fee (pg,
|
||||
start_date,
|
||||
&sd,
|
||||
&ed,
|
||||
&wx,
|
||||
&pt,
|
||||
&he,
|
||||
&pal,
|
||||
&sig);
|
||||
start_date,
|
||||
&sd,
|
||||
&ed,
|
||||
&wx,
|
||||
&pt,
|
||||
&he,
|
||||
&pal,
|
||||
&sig);
|
||||
if (qs < 0)
|
||||
return qs;
|
||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
|
||||
@ -113,7 +113,7 @@ TEH_PG_insert_global_fee (void *cls,
|
||||
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
|
||||
}
|
||||
|
||||
/* Used in #postgres_insert_global_fee */
|
||||
/* Used in #postgres_insert_global_fee */
|
||||
PREPARE (pg,
|
||||
"insert_global_fee",
|
||||
"INSERT INTO global_fee "
|
||||
|
@ -40,11 +40,11 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_global_fee (void *cls,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative purse_timeout,
|
||||
struct GNUNET_TIME_Relative history_expiration,
|
||||
uint32_t purse_account_limit,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_GlobalFeeSet *fees,
|
||||
struct GNUNET_TIME_Relative purse_timeout,
|
||||
struct GNUNET_TIME_Relative history_expiration,
|
||||
uint32_t purse_account_limit,
|
||||
const struct TALER_MasterSignatureP *master_sig);
|
||||
#endif
|
||||
|
@ -51,7 +51,7 @@ TEH_PG_insert_history_request (
|
||||
idempotent),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
/* Used in #postgres_insert_history_request() */
|
||||
/* Used in #postgres_insert_history_request() */
|
||||
PREPARE (pg,
|
||||
"call_history_request",
|
||||
"SELECT"
|
||||
|
@ -43,7 +43,7 @@ TEH_PG_insert_kyc_requirement_for_account (
|
||||
requirement_row),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
/* Used in #postgres_insert_kyc_requirement_for_account() */
|
||||
/* Used in #postgres_insert_kyc_requirement_for_account() */
|
||||
PREPARE (pg,
|
||||
"insert_legitimization_requirement",
|
||||
"INSERT INTO legitimization_requirements"
|
||||
|
@ -41,4 +41,5 @@ TEH_PG_insert_kyc_requirement_for_account (
|
||||
const char *provider_section,
|
||||
const struct TALER_PaytoHashP *h_payto,
|
||||
uint64_t *requirement_row);
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@ TEH_PG_insert_kyc_requirement_process (
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
/* Used in #postgres_insert_kyc_requirement_process() */
|
||||
/* Used in #postgres_insert_kyc_requirement_process() */
|
||||
PREPARE (pg,
|
||||
"insert_legitimization_process",
|
||||
"INSERT INTO legitimization_processes"
|
||||
|
@ -45,4 +45,5 @@ TEH_PG_insert_kyc_requirement_process (
|
||||
const char *provider_account_id,
|
||||
const char *provider_legitimization_id,
|
||||
uint64_t *process_row);
|
||||
|
||||
#endif
|
||||
|
@ -40,12 +40,12 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_partner (void *cls,
|
||||
const struct TALER_MasterPublicKeyP *master_pub,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
struct GNUNET_TIME_Relative wad_frequency,
|
||||
const struct TALER_Amount *wad_fee,
|
||||
const char *partner_base_url,
|
||||
const struct TALER_MasterPublicKeyP *master_pub,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
struct GNUNET_TIME_Relative wad_frequency,
|
||||
const struct TALER_Amount *wad_fee,
|
||||
const char *partner_base_url,
|
||||
const struct TALER_MasterSignatureP *master_sig);
|
||||
|
||||
#endif
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_refund (void *cls,
|
||||
const struct TALER_EXCHANGEDB_Refund *refund)
|
||||
const struct TALER_EXCHANGEDB_Refund *refund)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -45,7 +45,7 @@ TEH_PG_insert_refund (void *cls,
|
||||
TALER_amount_cmp_currency (&refund->details.refund_amount,
|
||||
&refund->details.refund_fee));
|
||||
|
||||
/* Used in #postgres_insert_refund() to store refund information */
|
||||
/* Used in #postgres_insert_refund() to store refund information */
|
||||
PREPARE (pg,
|
||||
"insert_refund",
|
||||
"INSERT INTO refunds "
|
||||
|
@ -57,20 +57,20 @@ TEH_PG_insert_reserve_closed (
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
/* Used in #postgres_insert_reserve_closed() */
|
||||
/* Used in #postgres_insert_reserve_closed() */
|
||||
PREPARE (pg,
|
||||
"reserves_close_insert",
|
||||
"INSERT INTO reserves_close "
|
||||
"(reserve_pub"
|
||||
",execution_date"
|
||||
",wtid"
|
||||
",wire_target_h_payto"
|
||||
",amount_val"
|
||||
",amount_frac"
|
||||
",closing_fee_val"
|
||||
",closing_fee_frac"
|
||||
",close_request_row"
|
||||
") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);");
|
||||
"reserves_close_insert",
|
||||
"INSERT INTO reserves_close "
|
||||
"(reserve_pub"
|
||||
",execution_date"
|
||||
",wtid"
|
||||
",wire_target_h_payto"
|
||||
",amount_val"
|
||||
",amount_frac"
|
||||
",closing_fee_val"
|
||||
",closing_fee_frac"
|
||||
",close_request_row"
|
||||
") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);");
|
||||
|
||||
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"reserves_close_insert",
|
||||
@ -83,7 +83,7 @@ TEH_PG_insert_reserve_closed (
|
||||
reserve.pub = *reserve_pub;
|
||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
(qs = TEH_PG_reserves_get (cls,
|
||||
&reserve)))
|
||||
&reserve)))
|
||||
{
|
||||
/* Existence should have been checked before we got here... */
|
||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||
@ -110,5 +110,5 @@ TEH_PG_insert_reserve_closed (
|
||||
GNUNET_break (TALER_AAR_RESULT_ZERO == ret);
|
||||
}
|
||||
return TEH_PG_reserves_update (cls,
|
||||
&reserve);
|
||||
&reserve);
|
||||
}
|
||||
|
@ -37,8 +37,8 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_wire (void *cls,
|
||||
const char *payto_uri,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
const char *payto_uri,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
const struct TALER_MasterSignatureP *master_sig);
|
||||
|
||||
#endif
|
||||
|
@ -28,11 +28,11 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_wire_fee (void *cls,
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_WireFeeSet *fees,
|
||||
const struct TALER_MasterSignatureP *master_sig)
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_WireFeeSet *fees,
|
||||
const struct TALER_MasterSignatureP *master_sig)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
@ -51,12 +51,12 @@ TEH_PG_insert_wire_fee (void *cls,
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
|
||||
qs = TEH_PG_get_wire_fee (pg,
|
||||
type,
|
||||
start_date,
|
||||
&sd,
|
||||
&ed,
|
||||
&wx,
|
||||
&sig);
|
||||
type,
|
||||
start_date,
|
||||
&sd,
|
||||
&ed,
|
||||
&wx,
|
||||
&sig);
|
||||
if (qs < 0)
|
||||
return qs;
|
||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
|
||||
@ -88,7 +88,7 @@ TEH_PG_insert_wire_fee (void *cls,
|
||||
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
|
||||
}
|
||||
|
||||
/* Used in #postgres_insert_wire_fee */
|
||||
/* Used in #postgres_insert_wire_fee */
|
||||
PREPARE (pg,
|
||||
"insert_wire_fee",
|
||||
"INSERT INTO wire_fee "
|
||||
|
@ -38,9 +38,9 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_insert_wire_fee (void *cls,
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_WireFeeSet *fees,
|
||||
const char *type,
|
||||
struct GNUNET_TIME_Timestamp start_date,
|
||||
struct GNUNET_TIME_Timestamp end_date,
|
||||
const struct TALER_WireFeeSet *fees,
|
||||
const struct TALER_MasterSignatureP *master_sig);
|
||||
#endif
|
||||
|
@ -36,6 +36,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_iterate_active_auditors (void *cls,
|
||||
TALER_EXCHANGEDB_AuditorsCallback cb,
|
||||
TALER_EXCHANGEDB_AuditorsCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -37,7 +37,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_iterate_active_signkeys (void *cls,
|
||||
TALER_EXCHANGEDB_ActiveSignkeysCallback cb,
|
||||
TALER_EXCHANGEDB_ActiveSignkeysCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -41,4 +41,5 @@ TEH_PG_iterate_auditor_denominations (
|
||||
void *cls,
|
||||
TALER_EXCHANGEDB_AuditorDenominationsCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_iterate_denomination_info (void *cls,
|
||||
TALER_EXCHANGEDB_DenominationCallback cb,
|
||||
TALER_EXCHANGEDB_DenominationCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@
|
||||
*/
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_iterate_denominations (void *cls,
|
||||
TALER_EXCHANGEDB_DenominationsCallback cb,
|
||||
TALER_EXCHANGEDB_DenominationsCallback cb,
|
||||
void *cb_cls);
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "pg_helper.h"
|
||||
|
||||
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_kyc_provider_account_lookup (
|
||||
void *cls,
|
||||
@ -48,7 +47,7 @@ TEH_PG_kyc_provider_account_lookup (
|
||||
process_row),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
/* Used in #postgres_kyc_provider_account_lookup() */
|
||||
/* Used in #postgres_kyc_provider_account_lookup() */
|
||||
PREPARE (pg,
|
||||
"get_wire_target_by_legitimization_id",
|
||||
"SELECT "
|
||||
|
@ -44,4 +44,5 @@ TEH_PG_kyc_provider_account_lookup (
|
||||
const char *provider_legitimization_id,
|
||||
struct TALER_PaytoHashP *h_payto,
|
||||
uint64_t *process_row);
|
||||
|
||||
#endif
|
||||
|
@ -46,7 +46,7 @@ TEH_PG_lookup_auditor_status (
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
/* Used in #postgres_lookup_auditor_status() */
|
||||
/* Used in #postgres_lookup_auditor_status() */
|
||||
PREPARE (pg,
|
||||
"lookup_auditor_status",
|
||||
"SELECT"
|
||||
|
@ -60,7 +60,7 @@ TEH_PG_lookup_denomination_key (
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
/* used in #postgres_lookup_denomination_key() */
|
||||
/* used in #postgres_lookup_denomination_key() */
|
||||
PREPARE (pg,
|
||||
"lookup_denomination_key",
|
||||
"SELECT"
|
||||
|
@ -48,4 +48,5 @@ TEH_PG_lookup_global_fee_by_time (
|
||||
struct GNUNET_TIME_Relative *purse_timeout,
|
||||
struct GNUNET_TIME_Relative *history_expiration,
|
||||
uint32_t *purse_account_limit);
|
||||
|
||||
#endif
|
||||
|
@ -47,4 +47,5 @@ TEH_PG_lookup_kyc_process_by_account (
|
||||
struct GNUNET_TIME_Absolute *expiration,
|
||||
char **provider_account_id,
|
||||
char **provider_legitimization_id);
|
||||
|
||||
#endif
|
||||
|
@ -62,4 +62,3 @@ TEH_PG_lookup_signing_key (
|
||||
params,
|
||||
rs);
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
|
||||
enum GNUNET_DB_QueryStatus
|
||||
TEH_PG_lookup_wire_timestamp (void *cls,
|
||||
const char *payto_uri,
|
||||
struct GNUNET_TIME_Timestamp *last_date)
|
||||
const char *payto_uri,
|
||||
struct GNUNET_TIME_Timestamp *last_date)
|
||||
{
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user