From 6eed8917c37ad047ee95e964cd516d82aacac473 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 31 Mar 2023 13:50:32 +0200 Subject: [PATCH] fix exchangedb build errors --- src/exchangedb/Makefile.am | 1 + src/exchangedb/pg_abort_shard.h | 5 +- src/exchangedb/pg_add_denomination_key.c | 5 +- .../pg_add_policy_fulfillment_proof.c | 2 +- src/exchangedb/pg_batch_ensure_coin_known.c | 247 +++++++++--------- src/exchangedb/pg_batch_ensure_coin_known.h | 18 +- src/exchangedb/pg_begin_revolving_shard.c | 36 +-- src/exchangedb/pg_begin_revolving_shard.h | 9 +- src/exchangedb/pg_begin_shard.h | 8 +- src/exchangedb/pg_commit.c | 2 +- src/exchangedb/pg_complete_shard.h | 5 +- src/exchangedb/pg_count_known_coins.c | 4 +- src/exchangedb/pg_count_known_coins.h | 2 +- .../pg_create_aggregation_transient.c | 22 +- .../pg_delete_aggregation_transient.c | 2 - src/exchangedb/pg_delete_shard_locks.c | 1 - src/exchangedb/pg_do_batch_withdraw.c | 5 +- src/exchangedb/pg_do_batch_withdraw_insert.c | 6 +- src/exchangedb/pg_do_deposit.c | 4 +- src/exchangedb/pg_do_melt.c | 2 +- src/exchangedb/pg_do_purse_merge.c | 2 +- src/exchangedb/pg_do_recoup.c | 1 - src/exchangedb/pg_do_recoup_refresh.h | 1 + src/exchangedb/pg_do_refund.c | 2 +- src/exchangedb/pg_do_withdraw.c | 2 - src/exchangedb/pg_drain_kyc_alert.c | 4 +- src/exchangedb/pg_drain_kyc_alert.h | 2 +- src/exchangedb/pg_ensure_coin_known.c | 8 +- src/exchangedb/pg_ensure_coin_known.h | 6 +- src/exchangedb/pg_event_listen.c | 8 +- src/exchangedb/pg_event_listen.h | 6 +- src/exchangedb/pg_event_listen_cancel.c | 3 +- src/exchangedb/pg_event_notify.c | 6 +- src/exchangedb/pg_event_notify.h | 4 +- .../pg_find_aggregation_transient.c | 2 +- src/exchangedb/pg_gc.h | 1 + src/exchangedb/pg_get_coin_denomination.c | 8 +- .../pg_get_denomination_revocation.c | 18 +- .../pg_get_denomination_revocation.h | 1 + src/exchangedb/pg_get_extension_manifest.h | 3 +- src/exchangedb/pg_get_global_fee.c | 54 ++-- src/exchangedb/pg_get_global_fee.h | 14 +- src/exchangedb/pg_get_global_fees.c | 11 +- src/exchangedb/pg_get_global_fees.h | 3 +- src/exchangedb/pg_get_known_coin.c | 10 +- src/exchangedb/pg_get_known_coin.h | 2 +- src/exchangedb/pg_get_melt.c | 10 +- src/exchangedb/pg_get_melt.h | 4 +- src/exchangedb/pg_get_old_coin_by_h_blind.c | 3 +- src/exchangedb/pg_get_old_coin_by_h_blind.h | 1 + src/exchangedb/pg_get_policy_details.c | 1 - src/exchangedb/pg_get_purse_deposit.c | 2 +- src/exchangedb/pg_get_purse_request.c | 3 +- src/exchangedb/pg_get_ready_deposit.h | 6 +- src/exchangedb/pg_get_refresh_reveal.c | 13 +- src/exchangedb/pg_get_refresh_reveal.h | 4 +- src/exchangedb/pg_get_reserve_balance.c | 4 +- src/exchangedb/pg_get_reserve_balance.h | 2 +- src/exchangedb/pg_get_reserve_by_h_blind.c | 2 +- src/exchangedb/pg_get_wire_accounts.c | 18 +- src/exchangedb/pg_get_wire_accounts.h | 2 +- src/exchangedb/pg_get_wire_fee.c | 43 ++- src/exchangedb/pg_get_wire_fee.h | 10 +- src/exchangedb/pg_get_wire_fees.c | 6 +- src/exchangedb/pg_get_wire_fees.h | 4 +- src/exchangedb/pg_get_withdraw_info.c | 8 +- src/exchangedb/pg_have_deposit2.c | 44 ++-- .../pg_insert_aggregation_tracking.c | 1 - .../pg_insert_aggregation_tracking.h | 1 - src/exchangedb/pg_insert_auditor.c | 10 +- src/exchangedb/pg_insert_auditor.h | 6 +- src/exchangedb/pg_insert_contract.c | 30 +-- .../pg_insert_denomination_revocation.c | 2 +- src/exchangedb/pg_insert_deposit.h | 2 +- src/exchangedb/pg_insert_drain_profit.c | 2 +- src/exchangedb/pg_insert_global_fee.c | 32 +-- src/exchangedb/pg_insert_global_fee.h | 12 +- src/exchangedb/pg_insert_history_request.c | 2 +- .../pg_insert_kyc_requirement_for_account.c | 2 +- .../pg_insert_kyc_requirement_for_account.h | 1 + .../pg_insert_kyc_requirement_process.c | 2 +- .../pg_insert_kyc_requirement_process.h | 1 + src/exchangedb/pg_insert_partner.h | 12 +- src/exchangedb/pg_insert_refund.c | 4 +- src/exchangedb/pg_insert_reserve_closed.c | 30 +-- src/exchangedb/pg_insert_wire.h | 4 +- src/exchangedb/pg_insert_wire_fee.c | 24 +- src/exchangedb/pg_insert_wire_fee.h | 8 +- src/exchangedb/pg_iterate_active_auditors.h | 3 +- src/exchangedb/pg_iterate_active_signkeys.h | 2 +- .../pg_iterate_auditor_denominations.h | 1 + src/exchangedb/pg_iterate_denomination_info.h | 2 +- src/exchangedb/pg_iterate_denominations.h | 2 +- .../pg_kyc_provider_account_lookup.c | 3 +- .../pg_kyc_provider_account_lookup.h | 1 + src/exchangedb/pg_lookup_auditor_status.c | 2 +- src/exchangedb/pg_lookup_denomination_key.c | 2 +- src/exchangedb/pg_lookup_global_fee_by_time.h | 1 + .../pg_lookup_kyc_process_by_account.h | 1 + src/exchangedb/pg_lookup_signing_key.c | 1 - src/exchangedb/pg_lookup_wire_timestamp.c | 4 +- src/exchangedb/pg_lookup_wire_timestamp.h | 2 +- src/exchangedb/pg_profit_drains_get_pending.c | 2 +- .../pg_profit_drains_set_finished.c | 16 +- src/exchangedb/pg_release_revolving_shard.c | 6 +- src/exchangedb/pg_release_revolving_shard.h | 4 +- src/exchangedb/pg_reserves_get.c | 4 +- src/exchangedb/pg_reserves_get_origin.c | 2 +- src/exchangedb/pg_reserves_in_insert.c | 3 +- src/exchangedb/pg_reserves_update.c | 2 +- ...select_aggregation_amounts_for_kyc_check.c | 3 - ...select_aggregation_amounts_for_kyc_check.h | 1 + .../pg_select_aggregation_transient.c | 2 +- src/exchangedb/pg_select_auditor_denom_sig.c | 1 - src/exchangedb/pg_select_contract.c | 26 +- src/exchangedb/pg_select_contract.h | 8 +- src/exchangedb/pg_select_contract_by_purse.c | 2 +- .../pg_select_deposits_missing_wire.c | 19 +- .../pg_select_deposits_missing_wire.h | 6 +- ..._select_history_requests_above_serial_id.c | 2 - .../pg_select_merge_amounts_for_kyc_check.c | 4 +- ...g_select_purse_decisions_above_serial_id.c | 1 - ...g_select_purse_decisions_above_serial_id.h | 1 + src/exchangedb/pg_select_purse_merge.c | 2 +- .../pg_select_recoup_above_serial_id.c | 4 +- ...pg_select_recoup_refresh_above_serial_id.c | 5 +- .../pg_select_refreshes_above_serial_id.c | 8 +- src/exchangedb/pg_select_refunds_by_coin.h | 1 + .../pg_select_reserves_in_above_serial_id.c | 4 +- ...t_reserves_in_above_serial_id_by_account.c | 4 +- .../pg_select_wire_out_above_serial_id.c | 3 +- ...lect_wire_out_above_serial_id_by_account.c | 3 +- ...lect_wire_out_above_serial_id_by_account.h | 1 + ...pg_select_withdraw_amounts_for_kyc_check.c | 28 +- ...pg_select_withdraw_amounts_for_kyc_check.h | 1 + .../pg_select_withdrawals_above_serial_id.c | 3 +- .../pg_select_withdrawals_above_serial_id.h | 1 + src/exchangedb/pg_set_extension_manifest.c | 4 +- src/exchangedb/pg_set_extension_manifest.h | 2 +- src/exchangedb/pg_set_purse_balance.c | 3 - src/exchangedb/pg_setup_wire_target.c | 2 +- src/exchangedb/pg_setup_wire_target.h | 2 +- src/exchangedb/pg_store_wire_transfer_out.c | 2 +- .../pg_update_aggregation_transient.c | 3 +- src/exchangedb/pg_update_auditor.c | 30 +-- src/exchangedb/pg_update_auditor.h | 8 +- src/exchangedb/pg_update_wire.c | 8 +- src/exchangedb/pg_update_wire.h | 4 +- src/exchangedb/pg_wire_prepare_data_get.c | 10 +- src/exchangedb/pg_wire_prepare_data_get.h | 7 +- src/exchangedb/pg_wire_prepare_data_insert.c | 22 +- src/exchangedb/pg_wire_prepare_data_insert.h | 5 +- .../pg_wire_prepare_data_mark_failed.c | 2 +- .../pg_wire_prepare_data_mark_failed.h | 1 + .../pg_wire_prepare_data_mark_finished.c | 10 +- .../pg_wire_prepare_data_mark_finished.h | 1 + src/exchangedb/test_exchangedb_by_j.c | 131 +++++----- src/include/taler_exchangedb_plugin.h | 33 +-- 158 files changed, 696 insertions(+), 750 deletions(-) diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am index 9757aefff..de76997cb 100644 --- a/src/exchangedb/Makefile.am +++ b/src/exchangedb/Makefile.am @@ -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 \ diff --git a/src/exchangedb/pg_abort_shard.h b/src/exchangedb/pg_abort_shard.h index 070b48dab..e52ace5f6 100644 --- a/src/exchangedb/pg_abort_shard.h +++ b/src/exchangedb/pg_abort_shard.h @@ -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 diff --git a/src/exchangedb/pg_add_denomination_key.c b/src/exchangedb/pg_add_denomination_key.c index e115a44ec..fa6d92ed6 100644 --- a/src/exchangedb/pg_add_denomination_key.c +++ b/src/exchangedb/pg_add_denomination_key.c @@ -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); } - diff --git a/src/exchangedb/pg_add_policy_fulfillment_proof.c b/src/exchangedb/pg_add_policy_fulfillment_proof.c index bb06206ae..103de7ad2 100644 --- a/src/exchangedb/pg_add_policy_fulfillment_proof.c +++ b/src/exchangedb/pg_add_policy_fulfillment_proof.c @@ -94,7 +94,7 @@ TEH_PG_add_policy_fulfillment_proof ( GNUNET_PQ_result_spec_end }; - + qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "insert_proof_into_policy_fulfillments", params, diff --git a/src/exchangedb/pg_batch_ensure_coin_known.c b/src/exchangedb/pg_batch_ensure_coin_known.c index d246e6228..e49813064 100644 --- a/src/exchangedb/pg_batch_ensure_coin_known.c +++ b/src/exchangedb/pg_batch_ensure_coin_known.c @@ -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; } diff --git a/src/exchangedb/pg_batch_ensure_coin_known.h b/src/exchangedb/pg_batch_ensure_coin_known.h index ce2b2f4ce..a80f9d88b 100644 --- a/src/exchangedb/pg_batch_ensure_coin_known.h +++ b/src/exchangedb/pg_batch_ensure_coin_known.h @@ -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 diff --git a/src/exchangedb/pg_begin_revolving_shard.c b/src/exchangedb/pg_begin_revolving_shard.c index 888d7fd20..86cdf80fd 100644 --- a/src/exchangedb/pg_begin_revolving_shard.c +++ b/src/exchangedb/pg_begin_revolving_shard.c @@ -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" diff --git a/src/exchangedb/pg_begin_revolving_shard.h b/src/exchangedb/pg_begin_revolving_shard.h index bdbca4f11..0755f886b 100644 --- a/src/exchangedb/pg_begin_revolving_shard.h +++ b/src/exchangedb/pg_begin_revolving_shard.h @@ -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 diff --git a/src/exchangedb/pg_begin_shard.h b/src/exchangedb/pg_begin_shard.h index 39bd834e9..16f19491d 100644 --- a/src/exchangedb/pg_begin_shard.h +++ b/src/exchangedb/pg_begin_shard.h @@ -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 diff --git a/src/exchangedb/pg_commit.c b/src/exchangedb/pg_commit.c index f1e61ee34..8c4f87c90 100644 --- a/src/exchangedb/pg_commit.c +++ b/src/exchangedb/pg_commit.c @@ -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"); diff --git a/src/exchangedb/pg_complete_shard.h b/src/exchangedb/pg_complete_shard.h index 8693f402e..f06c0483b 100644 --- a/src/exchangedb/pg_complete_shard.h +++ b/src/exchangedb/pg_complete_shard.h @@ -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 diff --git a/src/exchangedb/pg_count_known_coins.c b/src/exchangedb/pg_count_known_coins.c index 28c4612fc..872965ac9 100644 --- a/src/exchangedb/pg_count_known_coins.c +++ b/src/exchangedb/pg_count_known_coins.c @@ -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; diff --git a/src/exchangedb/pg_count_known_coins.h b/src/exchangedb/pg_count_known_coins.h index f5dd4f27f..69f07bdf4 100644 --- a/src/exchangedb/pg_count_known_coins.h +++ b/src/exchangedb/pg_count_known_coins.h @@ -33,7 +33,7 @@ */ long long TEH_PG_count_known_coins (void *cls, - const struct + const struct TALER_DenominationHashP *denom_pub_hash); #endif diff --git a/src/exchangedb/pg_create_aggregation_transient.c b/src/exchangedb/pg_create_aggregation_transient.c index 4ced9da04..80fba8bf4 100644 --- a/src/exchangedb/pg_create_aggregation_transient.c +++ b/src/exchangedb/pg_create_aggregation_transient.c @@ -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); diff --git a/src/exchangedb/pg_delete_aggregation_transient.c b/src/exchangedb/pg_delete_aggregation_transient.c index d0622c0f7..63c5c0a23 100644 --- a/src/exchangedb/pg_delete_aggregation_transient.c +++ b/src/exchangedb/pg_delete_aggregation_transient.c @@ -48,5 +48,3 @@ TEH_PG_delete_aggregation_transient ( "delete_aggregation_transient", params); } - - diff --git a/src/exchangedb/pg_delete_shard_locks.c b/src/exchangedb/pg_delete_shard_locks.c index e55cf25ff..dbb0f29ac 100644 --- a/src/exchangedb/pg_delete_shard_locks.c +++ b/src/exchangedb/pg_delete_shard_locks.c @@ -39,4 +39,3 @@ TEH_PG_delete_shard_locks (void *cls) return GNUNET_PQ_exec_statements (pg->conn, es); } - diff --git a/src/exchangedb/pg_do_batch_withdraw.c b/src/exchangedb/pg_do_batch_withdraw.c index 8ef1be268..3dee20d22 100644 --- a/src/exchangedb/pg_do_batch_withdraw.c +++ b/src/exchangedb/pg_do_batch_withdraw.c @@ -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); } - diff --git a/src/exchangedb/pg_do_batch_withdraw_insert.c b/src/exchangedb/pg_do_batch_withdraw_insert.c index 8d3aac688..8be18f7cc 100644 --- a/src/exchangedb/pg_do_batch_withdraw_insert.c +++ b/src/exchangedb/pg_do_batch_withdraw_insert.c @@ -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 " diff --git a/src/exchangedb/pg_do_deposit.c b/src/exchangedb/pg_do_deposit.c index c8f25e5bc..771c50af3 100644 --- a/src/exchangedb/pg_do_deposit.c +++ b/src/exchangedb/pg_do_deposit.c @@ -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 " diff --git a/src/exchangedb/pg_do_melt.c b/src/exchangedb/pg_do_melt.c index 6f81ff38b..40a54d43b 100644 --- a/src/exchangedb/pg_do_melt.c +++ b/src/exchangedb/pg_do_melt.c @@ -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 " diff --git a/src/exchangedb/pg_do_purse_merge.c b/src/exchangedb/pg_do_purse_merge.c index 518b66bf6..5d11b0565 100644 --- a/src/exchangedb/pg_do_purse_merge.c +++ b/src/exchangedb/pg_do_purse_merge.c @@ -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" diff --git a/src/exchangedb/pg_do_recoup.c b/src/exchangedb/pg_do_recoup.c index 00f7bdd8b..1f74104ed 100644 --- a/src/exchangedb/pg_do_recoup.c +++ b/src/exchangedb/pg_do_recoup.c @@ -70,7 +70,6 @@ TEH_PG_do_recoup ( }; - PREPARE (pg, "call_recoup", "SELECT " diff --git a/src/exchangedb/pg_do_recoup_refresh.h b/src/exchangedb/pg_do_recoup_refresh.h index 3ac0f0a07..fbd791d44 100644 --- a/src/exchangedb/pg_do_recoup_refresh.h +++ b/src/exchangedb/pg_do_recoup_refresh.h @@ -53,4 +53,5 @@ TEH_PG_do_recoup_refresh ( struct GNUNET_TIME_Timestamp *recoup_timestamp, bool *recoup_ok, bool *internal_failure); + #endif diff --git a/src/exchangedb/pg_do_refund.c b/src/exchangedb/pg_do_refund.c index 1059f9cbb..0b9665c48 100644 --- a/src/exchangedb/pg_do_refund.c +++ b/src/exchangedb/pg_do_refund.c @@ -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 " diff --git a/src/exchangedb/pg_do_withdraw.c b/src/exchangedb/pg_do_withdraw.c index 87e4dd1d0..01bbfff5b 100644 --- a/src/exchangedb/pg_do_withdraw.c +++ b/src/exchangedb/pg_do_withdraw.c @@ -82,5 +82,3 @@ TEH_PG_do_withdraw ( params, rs); } - - diff --git a/src/exchangedb/pg_drain_kyc_alert.c b/src/exchangedb/pg_drain_kyc_alert.c index d635d95e9..4388334e9 100644 --- a/src/exchangedb/pg_drain_kyc_alert.c +++ b/src/exchangedb/pg_drain_kyc_alert.c @@ -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[] = { diff --git a/src/exchangedb/pg_drain_kyc_alert.h b/src/exchangedb/pg_drain_kyc_alert.h index bfaf04892..7425f472d 100644 --- a/src/exchangedb/pg_drain_kyc_alert.h +++ b/src/exchangedb/pg_drain_kyc_alert.h @@ -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 diff --git a/src/exchangedb/pg_ensure_coin_known.c b/src/exchangedb/pg_ensure_coin_known.c index 7ad37bf1d..721123fd3 100644 --- a/src/exchangedb/pg_ensure_coin_known.c +++ b/src/exchangedb/pg_ensure_coin_known.c @@ -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; diff --git a/src/exchangedb/pg_ensure_coin_known.h b/src/exchangedb/pg_ensure_coin_known.h index 76581d4b7..68c101735 100644 --- a/src/exchangedb/pg_ensure_coin_known.h +++ b/src/exchangedb/pg_ensure_coin_known.h @@ -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 diff --git a/src/exchangedb/pg_event_listen.c b/src/exchangedb/pg_event_listen.c index c557ed3c5..6e1d32843 100644 --- a/src/exchangedb/pg_event_listen.c +++ b/src/exchangedb/pg_event_listen.c @@ -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; diff --git a/src/exchangedb/pg_event_listen.h b/src/exchangedb/pg_event_listen.h index 1be140776..7e1e83a0e 100644 --- a/src/exchangedb/pg_event_listen.h +++ b/src/exchangedb/pg_event_listen.h @@ -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 diff --git a/src/exchangedb/pg_event_listen_cancel.c b/src/exchangedb/pg_event_listen_cancel.c index 5d65827c2..9d776684d 100644 --- a/src/exchangedb/pg_event_listen_cancel.c +++ b/src/exchangedb/pg_event_listen_cancel.c @@ -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; diff --git a/src/exchangedb/pg_event_notify.c b/src/exchangedb/pg_event_notify.c index 577f4acb8..188855775 100644 --- a/src/exchangedb/pg_event_notify.c +++ b/src/exchangedb/pg_event_notify.c @@ -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; diff --git a/src/exchangedb/pg_event_notify.h b/src/exchangedb/pg_event_notify.h index 3b937cbab..85069659b 100644 --- a/src/exchangedb/pg_event_notify.h +++ b/src/exchangedb/pg_event_notify.h @@ -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 diff --git a/src/exchangedb/pg_find_aggregation_transient.c b/src/exchangedb/pg_find_aggregation_transient.c index a5f367b5f..ecc6362cf 100644 --- a/src/exchangedb/pg_find_aggregation_transient.c +++ b/src/exchangedb/pg_find_aggregation_transient.c @@ -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" diff --git a/src/exchangedb/pg_gc.h b/src/exchangedb/pg_gc.h index 9e6ffbc3d..803581488 100644 --- a/src/exchangedb/pg_gc.h +++ b/src/exchangedb/pg_gc.h @@ -35,4 +35,5 @@ */ enum GNUNET_GenericReturnValue TEH_PG_gc (void *cls); + #endif diff --git a/src/exchangedb/pg_get_coin_denomination.c b/src/exchangedb/pg_get_coin_denomination.c index e82b86aa9..9f9256f6f 100644 --- a/src/exchangedb/pg_get_coin_denomination.c +++ b/src/exchangedb/pg_get_coin_denomination.c @@ -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); } - - diff --git a/src/exchangedb/pg_get_denomination_revocation.c b/src/exchangedb/pg_get_denomination_revocation.c index 4d29d88c4..5e7a3a322 100644 --- a/src/exchangedb/pg_get_denomination_revocation.c +++ b/src/exchangedb/pg_get_denomination_revocation.c @@ -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", diff --git a/src/exchangedb/pg_get_denomination_revocation.h b/src/exchangedb/pg_get_denomination_revocation.h index d022c822d..5f7f27227 100644 --- a/src/exchangedb/pg_get_denomination_revocation.h +++ b/src/exchangedb/pg_get_denomination_revocation.h @@ -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 diff --git a/src/exchangedb/pg_get_extension_manifest.h b/src/exchangedb/pg_get_extension_manifest.h index 3756b7f4c..e8331ad9b 100644 --- a/src/exchangedb/pg_get_extension_manifest.h +++ b/src/exchangedb/pg_get_extension_manifest.h @@ -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 diff --git a/src/exchangedb/pg_get_global_fee.c b/src/exchangedb/pg_get_global_fee.c index 6f6bbafef..990113fed 100644 --- a/src/exchangedb/pg_get_global_fee.c +++ b/src/exchangedb/pg_get_global_fee.c @@ -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, diff --git a/src/exchangedb/pg_get_global_fee.h b/src/exchangedb/pg_get_global_fee.h index 0887d54d2..1e7c9e94b 100644 --- a/src/exchangedb/pg_get_global_fee.h +++ b/src/exchangedb/pg_get_global_fee.h @@ -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 diff --git a/src/exchangedb/pg_get_global_fees.c b/src/exchangedb/pg_get_global_fees.c index 0e1736bd4..e01eb2dab 100644 --- a/src/exchangedb/pg_get_global_fees.c +++ b/src/exchangedb/pg_get_global_fees.c @@ -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); } - - - - diff --git a/src/exchangedb/pg_get_global_fees.h b/src/exchangedb/pg_get_global_fees.h index c8f6f02c2..80c9b812f 100644 --- a/src/exchangedb/pg_get_global_fees.h +++ b/src/exchangedb/pg_get_global_fees.h @@ -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 diff --git a/src/exchangedb/pg_get_known_coin.c b/src/exchangedb/pg_get_known_coin.c index fe5c683bc..bab48c119 100644 --- a/src/exchangedb/pg_get_known_coin.c +++ b/src/exchangedb/pg_get_known_coin.c @@ -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" diff --git a/src/exchangedb/pg_get_known_coin.h b/src/exchangedb/pg_get_known_coin.h index d7f55b33c..c34bd2a97 100644 --- a/src/exchangedb/pg_get_known_coin.h +++ b/src/exchangedb/pg_get_known_coin.h @@ -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 diff --git a/src/exchangedb/pg_get_melt.c b/src/exchangedb/pg_get_melt.c index f239c605b..8e5685ec3 100644 --- a/src/exchangedb/pg_get_melt.c +++ b/src/exchangedb/pg_get_melt.c @@ -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" diff --git a/src/exchangedb/pg_get_melt.h b/src/exchangedb/pg_get_melt.h index 73d757a05..269960bad 100644 --- a/src/exchangedb/pg_get_melt.h +++ b/src/exchangedb/pg_get_melt.h @@ -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 diff --git a/src/exchangedb/pg_get_old_coin_by_h_blind.c b/src/exchangedb/pg_get_old_coin_by_h_blind.c index 385c3f1d1..dcce7b32f 100644 --- a/src/exchangedb/pg_get_old_coin_by_h_blind.c +++ b/src/exchangedb/pg_get_old_coin_by_h_blind.c @@ -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" diff --git a/src/exchangedb/pg_get_old_coin_by_h_blind.h b/src/exchangedb/pg_get_old_coin_by_h_blind.h index 1404990d9..93ed541b6 100644 --- a/src/exchangedb/pg_get_old_coin_by_h_blind.h +++ b/src/exchangedb/pg_get_old_coin_by_h_blind.h @@ -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 diff --git a/src/exchangedb/pg_get_policy_details.c b/src/exchangedb/pg_get_policy_details.c index fafdca53c..6e1b5c5dc 100644 --- a/src/exchangedb/pg_get_policy_details.c +++ b/src/exchangedb/pg_get_policy_details.c @@ -57,7 +57,6 @@ TEH_PG_get_policy_details ( }; - return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "get_policy_details", params, diff --git a/src/exchangedb/pg_get_purse_deposit.c b/src/exchangedb/pg_get_purse_deposit.c index 539bd5ece..8a135818d 100644 --- a/src/exchangedb/pg_get_purse_deposit.c +++ b/src/exchangedb/pg_get_purse_deposit.c @@ -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 " diff --git a/src/exchangedb/pg_get_purse_request.c b/src/exchangedb/pg_get_purse_request.c index ba8182857..c5f5aac76 100644 --- a/src/exchangedb/pg_get_purse_request.c +++ b/src/exchangedb/pg_get_purse_request.c @@ -59,7 +59,7 @@ TEH_PG_get_purse_request ( purse_sig), GNUNET_PQ_result_spec_end }; - + PREPARE (pg, "get_purse_request", "SELECT " @@ -80,4 +80,3 @@ TEH_PG_get_purse_request ( params, rs); } - diff --git a/src/exchangedb/pg_get_ready_deposit.h b/src/exchangedb/pg_get_ready_deposit.h index 19b6dafe4..b1dd7a968 100644 --- a/src/exchangedb/pg_get_ready_deposit.h +++ b/src/exchangedb/pg_get_ready_deposit.h @@ -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 diff --git a/src/exchangedb/pg_get_refresh_reveal.c b/src/exchangedb/pg_get_refresh_reveal.c index e2db082b7..07d632248 100644 --- a/src/exchangedb/pg_get_refresh_reveal.c +++ b/src/exchangedb/pg_get_refresh_reveal.c @@ -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 " diff --git a/src/exchangedb/pg_get_refresh_reveal.h b/src/exchangedb/pg_get_refresh_reveal.h index 0fcea26cd..15b57b343 100644 --- a/src/exchangedb/pg_get_refresh_reveal.h +++ b/src/exchangedb/pg_get_refresh_reveal.h @@ -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 diff --git a/src/exchangedb/pg_get_reserve_balance.c b/src/exchangedb/pg_get_reserve_balance.c index e08261fc0..7d5eb58f8 100644 --- a/src/exchangedb/pg_get_reserve_balance.c +++ b/src/exchangedb/pg_get_reserve_balance.c @@ -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[] = { diff --git a/src/exchangedb/pg_get_reserve_balance.h b/src/exchangedb/pg_get_reserve_balance.h index fd15f0d80..6dc88d906 100644 --- a/src/exchangedb/pg_get_reserve_balance.h +++ b/src/exchangedb/pg_get_reserve_balance.h @@ -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 diff --git a/src/exchangedb/pg_get_reserve_by_h_blind.c b/src/exchangedb/pg_get_reserve_by_h_blind.c index 2105b4766..f87fe6cd4 100644 --- a/src/exchangedb/pg_get_reserve_by_h_blind.c +++ b/src/exchangedb/pg_get_reserve_by_h_blind.c @@ -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" diff --git a/src/exchangedb/pg_get_wire_accounts.c b/src/exchangedb/pg_get_wire_accounts.c index 6986eaef2..43590acf8 100644 --- a/src/exchangedb/pg_get_wire_accounts.c +++ b/src/exchangedb/pg_get_wire_accounts.c @@ -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, diff --git a/src/exchangedb/pg_get_wire_accounts.h b/src/exchangedb/pg_get_wire_accounts.h index 4ddda0ed3..f4dc97ce0 100644 --- a/src/exchangedb/pg_get_wire_accounts.h +++ b/src/exchangedb/pg_get_wire_accounts.h @@ -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 diff --git a/src/exchangedb/pg_get_wire_fee.c b/src/exchangedb/pg_get_wire_fee.c index 4b4324766..4aab68b85 100644 --- a/src/exchangedb/pg_get_wire_fee.c +++ b/src/exchangedb/pg_get_wire_fee.c @@ -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, diff --git a/src/exchangedb/pg_get_wire_fee.h b/src/exchangedb/pg_get_wire_fee.h index 92107fe30..409a5c48b 100644 --- a/src/exchangedb/pg_get_wire_fee.h +++ b/src/exchangedb/pg_get_wire_fee.h @@ -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 diff --git a/src/exchangedb/pg_get_wire_fees.c b/src/exchangedb/pg_get_wire_fees.c index a83db151d..e34d44a9a 100644 --- a/src/exchangedb/pg_get_wire_fees.c +++ b/src/exchangedb/pg_get_wire_fees.c @@ -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[] = { diff --git a/src/exchangedb/pg_get_wire_fees.h b/src/exchangedb/pg_get_wire_fees.h index 83bacd674..798a514db 100644 --- a/src/exchangedb/pg_get_wire_fees.h +++ b/src/exchangedb/pg_get_wire_fees.h @@ -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 diff --git a/src/exchangedb/pg_get_withdraw_info.c b/src/exchangedb/pg_get_withdraw_info.c index ef3936269..d6a180b00 100644 --- a/src/exchangedb/pg_get_withdraw_info.c +++ b/src/exchangedb/pg_get_withdraw_info.c @@ -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" diff --git a/src/exchangedb/pg_have_deposit2.c b/src/exchangedb/pg_have_deposit2.c index 1616858c5..92c300605 100644 --- a/src/exchangedb/pg_have_deposit2.c +++ b/src/exchangedb/pg_have_deposit2.c @@ -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", diff --git a/src/exchangedb/pg_insert_aggregation_tracking.c b/src/exchangedb/pg_insert_aggregation_tracking.c index 01c5928ba..fe61b841d 100644 --- a/src/exchangedb/pg_insert_aggregation_tracking.c +++ b/src/exchangedb/pg_insert_aggregation_tracking.c @@ -51,4 +51,3 @@ TEH_PG_insert_aggregation_tracking ( "insert_aggregation_tracking", params); } - diff --git a/src/exchangedb/pg_insert_aggregation_tracking.h b/src/exchangedb/pg_insert_aggregation_tracking.h index 4f0ac1aae..e67c0e8e7 100644 --- a/src/exchangedb/pg_insert_aggregation_tracking.h +++ b/src/exchangedb/pg_insert_aggregation_tracking.h @@ -40,4 +40,3 @@ TEH_PG_insert_aggregation_tracking ( unsigned long long deposit_serial_id); #endif - diff --git a/src/exchangedb/pg_insert_auditor.c b/src/exchangedb/pg_insert_auditor.c index 757dfa625..2f1de7ba7 100644 --- a/src/exchangedb/pg_insert_auditor.c +++ b/src/exchangedb/pg_insert_auditor.c @@ -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 " diff --git a/src/exchangedb/pg_insert_auditor.h b/src/exchangedb/pg_insert_auditor.h index 7523282e4..8de388f23 100644 --- a/src/exchangedb/pg_insert_auditor.h +++ b/src/exchangedb/pg_insert_auditor.h @@ -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 diff --git a/src/exchangedb/pg_insert_contract.c b/src/exchangedb/pg_insert_contract.c index d3e6c23be..0274f8d93 100644 --- a/src/exchangedb/pg_insert_contract.c +++ b/src/exchangedb/pg_insert_contract.c @@ -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); diff --git a/src/exchangedb/pg_insert_denomination_revocation.c b/src/exchangedb/pg_insert_denomination_revocation.c index 061d7adc0..49445f262 100644 --- a/src/exchangedb/pg_insert_denomination_revocation.c +++ b/src/exchangedb/pg_insert_denomination_revocation.c @@ -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 " diff --git a/src/exchangedb/pg_insert_deposit.h b/src/exchangedb/pg_insert_deposit.h index 15de39eff..82cbcd542 100644 --- a/src/exchangedb/pg_insert_deposit.h +++ b/src/exchangedb/pg_insert_deposit.h @@ -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 diff --git a/src/exchangedb/pg_insert_drain_profit.c b/src/exchangedb/pg_insert_drain_profit.c index 19340eafb..34ab0332c 100644 --- a/src/exchangedb/pg_insert_drain_profit.c +++ b/src/exchangedb/pg_insert_drain_profit.c @@ -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 " diff --git a/src/exchangedb/pg_insert_global_fee.c b/src/exchangedb/pg_insert_global_fee.c index c08fc23bb..1c34016a7 100644 --- a/src/exchangedb/pg_insert_global_fee.c +++ b/src/exchangedb/pg_insert_global_fee.c @@ -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 " diff --git a/src/exchangedb/pg_insert_global_fee.h b/src/exchangedb/pg_insert_global_fee.h index 9780d5322..411345dc4 100644 --- a/src/exchangedb/pg_insert_global_fee.h +++ b/src/exchangedb/pg_insert_global_fee.h @@ -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 diff --git a/src/exchangedb/pg_insert_history_request.c b/src/exchangedb/pg_insert_history_request.c index 00270b1a1..ab3f39133 100644 --- a/src/exchangedb/pg_insert_history_request.c +++ b/src/exchangedb/pg_insert_history_request.c @@ -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" diff --git a/src/exchangedb/pg_insert_kyc_requirement_for_account.c b/src/exchangedb/pg_insert_kyc_requirement_for_account.c index be5cbac87..2552aae40 100644 --- a/src/exchangedb/pg_insert_kyc_requirement_for_account.c +++ b/src/exchangedb/pg_insert_kyc_requirement_for_account.c @@ -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" diff --git a/src/exchangedb/pg_insert_kyc_requirement_for_account.h b/src/exchangedb/pg_insert_kyc_requirement_for_account.h index 5f9bf6a48..c2f03b02a 100644 --- a/src/exchangedb/pg_insert_kyc_requirement_for_account.h +++ b/src/exchangedb/pg_insert_kyc_requirement_for_account.h @@ -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 diff --git a/src/exchangedb/pg_insert_kyc_requirement_process.c b/src/exchangedb/pg_insert_kyc_requirement_process.c index d520ac59c..f1ea5b490 100644 --- a/src/exchangedb/pg_insert_kyc_requirement_process.c +++ b/src/exchangedb/pg_insert_kyc_requirement_process.c @@ -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" diff --git a/src/exchangedb/pg_insert_kyc_requirement_process.h b/src/exchangedb/pg_insert_kyc_requirement_process.h index 3f354472e..df21db8cd 100644 --- a/src/exchangedb/pg_insert_kyc_requirement_process.h +++ b/src/exchangedb/pg_insert_kyc_requirement_process.h @@ -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 diff --git a/src/exchangedb/pg_insert_partner.h b/src/exchangedb/pg_insert_partner.h index eed40a80e..3ebae786c 100644 --- a/src/exchangedb/pg_insert_partner.h +++ b/src/exchangedb/pg_insert_partner.h @@ -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 diff --git a/src/exchangedb/pg_insert_refund.c b/src/exchangedb/pg_insert_refund.c index 047df0334..8f9466575 100644 --- a/src/exchangedb/pg_insert_refund.c +++ b/src/exchangedb/pg_insert_refund.c @@ -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 " diff --git a/src/exchangedb/pg_insert_reserve_closed.c b/src/exchangedb/pg_insert_reserve_closed.c index d17c37edc..963a38226 100644 --- a/src/exchangedb/pg_insert_reserve_closed.c +++ b/src/exchangedb/pg_insert_reserve_closed.c @@ -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); } diff --git a/src/exchangedb/pg_insert_wire.h b/src/exchangedb/pg_insert_wire.h index 15ce08674..670928d7c 100644 --- a/src/exchangedb/pg_insert_wire.h +++ b/src/exchangedb/pg_insert_wire.h @@ -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 diff --git a/src/exchangedb/pg_insert_wire_fee.c b/src/exchangedb/pg_insert_wire_fee.c index 278ec2bcb..ac14a8cbb 100644 --- a/src/exchangedb/pg_insert_wire_fee.c +++ b/src/exchangedb/pg_insert_wire_fee.c @@ -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 " diff --git a/src/exchangedb/pg_insert_wire_fee.h b/src/exchangedb/pg_insert_wire_fee.h index e53faf5a5..15c1a39f8 100644 --- a/src/exchangedb/pg_insert_wire_fee.h +++ b/src/exchangedb/pg_insert_wire_fee.h @@ -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 diff --git a/src/exchangedb/pg_iterate_active_auditors.h b/src/exchangedb/pg_iterate_active_auditors.h index 1247d2d3d..f0e2808e9 100644 --- a/src/exchangedb/pg_iterate_active_auditors.h +++ b/src/exchangedb/pg_iterate_active_auditors.h @@ -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 diff --git a/src/exchangedb/pg_iterate_active_signkeys.h b/src/exchangedb/pg_iterate_active_signkeys.h index b99dfa8df..5ebba9f5a 100644 --- a/src/exchangedb/pg_iterate_active_signkeys.h +++ b/src/exchangedb/pg_iterate_active_signkeys.h @@ -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 diff --git a/src/exchangedb/pg_iterate_auditor_denominations.h b/src/exchangedb/pg_iterate_auditor_denominations.h index da1f36701..1278e8a9f 100644 --- a/src/exchangedb/pg_iterate_auditor_denominations.h +++ b/src/exchangedb/pg_iterate_auditor_denominations.h @@ -41,4 +41,5 @@ TEH_PG_iterate_auditor_denominations ( void *cls, TALER_EXCHANGEDB_AuditorDenominationsCallback cb, void *cb_cls); + #endif diff --git a/src/exchangedb/pg_iterate_denomination_info.h b/src/exchangedb/pg_iterate_denomination_info.h index 57847a515..27c08d0a9 100644 --- a/src/exchangedb/pg_iterate_denomination_info.h +++ b/src/exchangedb/pg_iterate_denomination_info.h @@ -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 diff --git a/src/exchangedb/pg_iterate_denominations.h b/src/exchangedb/pg_iterate_denominations.h index a205fc6ba..9f59fc803 100644 --- a/src/exchangedb/pg_iterate_denominations.h +++ b/src/exchangedb/pg_iterate_denominations.h @@ -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 diff --git a/src/exchangedb/pg_kyc_provider_account_lookup.c b/src/exchangedb/pg_kyc_provider_account_lookup.c index 32cd65f7d..f3bd84c1a 100644 --- a/src/exchangedb/pg_kyc_provider_account_lookup.c +++ b/src/exchangedb/pg_kyc_provider_account_lookup.c @@ -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 " diff --git a/src/exchangedb/pg_kyc_provider_account_lookup.h b/src/exchangedb/pg_kyc_provider_account_lookup.h index 41bcb86ae..74f90d88d 100644 --- a/src/exchangedb/pg_kyc_provider_account_lookup.h +++ b/src/exchangedb/pg_kyc_provider_account_lookup.h @@ -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 diff --git a/src/exchangedb/pg_lookup_auditor_status.c b/src/exchangedb/pg_lookup_auditor_status.c index 5e62bfa9e..91afe6eaa 100644 --- a/src/exchangedb/pg_lookup_auditor_status.c +++ b/src/exchangedb/pg_lookup_auditor_status.c @@ -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" diff --git a/src/exchangedb/pg_lookup_denomination_key.c b/src/exchangedb/pg_lookup_denomination_key.c index 36ada96e4..759af1b5c 100644 --- a/src/exchangedb/pg_lookup_denomination_key.c +++ b/src/exchangedb/pg_lookup_denomination_key.c @@ -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" diff --git a/src/exchangedb/pg_lookup_global_fee_by_time.h b/src/exchangedb/pg_lookup_global_fee_by_time.h index 9ac7d7dcd..c5ff95fc6 100644 --- a/src/exchangedb/pg_lookup_global_fee_by_time.h +++ b/src/exchangedb/pg_lookup_global_fee_by_time.h @@ -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 diff --git a/src/exchangedb/pg_lookup_kyc_process_by_account.h b/src/exchangedb/pg_lookup_kyc_process_by_account.h index 40af6a7f6..0300b498c 100644 --- a/src/exchangedb/pg_lookup_kyc_process_by_account.h +++ b/src/exchangedb/pg_lookup_kyc_process_by_account.h @@ -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 diff --git a/src/exchangedb/pg_lookup_signing_key.c b/src/exchangedb/pg_lookup_signing_key.c index 3f31a6f49..3803d114f 100644 --- a/src/exchangedb/pg_lookup_signing_key.c +++ b/src/exchangedb/pg_lookup_signing_key.c @@ -62,4 +62,3 @@ TEH_PG_lookup_signing_key ( params, rs); } - diff --git a/src/exchangedb/pg_lookup_wire_timestamp.c b/src/exchangedb/pg_lookup_wire_timestamp.c index 19e915d48..17dffc706 100644 --- a/src/exchangedb/pg_lookup_wire_timestamp.c +++ b/src/exchangedb/pg_lookup_wire_timestamp.c @@ -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[] = { diff --git a/src/exchangedb/pg_lookup_wire_timestamp.h b/src/exchangedb/pg_lookup_wire_timestamp.h index 069dd940c..f2ee117de 100644 --- a/src/exchangedb/pg_lookup_wire_timestamp.h +++ b/src/exchangedb/pg_lookup_wire_timestamp.h @@ -34,7 +34,7 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_lookup_wire_timestamp (void *cls, - const char *payto_uri, + const char *payto_uri, struct GNUNET_TIME_Timestamp *last_date); #endif diff --git a/src/exchangedb/pg_profit_drains_get_pending.c b/src/exchangedb/pg_profit_drains_get_pending.c index a7044ebb8..f4a5d4517 100644 --- a/src/exchangedb/pg_profit_drains_get_pending.c +++ b/src/exchangedb/pg_profit_drains_get_pending.c @@ -57,7 +57,7 @@ TEH_PG_profit_drains_get_pending ( master_sig), GNUNET_PQ_result_spec_end }; - /* Used in #postgres_profit_drains_get_pending() */ + /* Used in #postgres_profit_drains_get_pending() */ PREPARE (pg, "get_ready_profit_drain", "SELECT" diff --git a/src/exchangedb/pg_profit_drains_set_finished.c b/src/exchangedb/pg_profit_drains_set_finished.c index b70af31fe..f0de27945 100644 --- a/src/exchangedb/pg_profit_drains_set_finished.c +++ b/src/exchangedb/pg_profit_drains_set_finished.c @@ -38,18 +38,12 @@ TEH_PG_profit_drains_set_finished ( }; PREPARE (pg, - "drain_profit_set_finished", - "UPDATE profit_drains" - " SET" - " executed=TRUE" - " WHERE profit_drain_serial_id=$1;"); + "drain_profit_set_finished", + "UPDATE profit_drains" + " SET" + " executed=TRUE" + " WHERE profit_drain_serial_id=$1;"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "drain_profit_set_finished", params); } - - - - - - diff --git a/src/exchangedb/pg_release_revolving_shard.c b/src/exchangedb/pg_release_revolving_shard.c index f176972b6..43e45c4bc 100644 --- a/src/exchangedb/pg_release_revolving_shard.c +++ b/src/exchangedb/pg_release_revolving_shard.c @@ -27,9 +27,9 @@ enum GNUNET_DB_QueryStatus TEH_PG_release_revolving_shard (void *cls, - const char *job_name, - uint32_t start_row, - uint32_t end_row) + const char *job_name, + uint32_t start_row, + uint32_t end_row) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { diff --git a/src/exchangedb/pg_release_revolving_shard.h b/src/exchangedb/pg_release_revolving_shard.h index f1712f538..ea65ab605 100644 --- a/src/exchangedb/pg_release_revolving_shard.h +++ b/src/exchangedb/pg_release_revolving_shard.h @@ -37,8 +37,8 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_release_revolving_shard (void *cls, - const char *job_name, - uint32_t start_row, + const char *job_name, + uint32_t start_row, uint32_t end_row); #endif diff --git a/src/exchangedb/pg_reserves_get.c b/src/exchangedb/pg_reserves_get.c index bea0022dd..d081ca00f 100644 --- a/src/exchangedb/pg_reserves_get.c +++ b/src/exchangedb/pg_reserves_get.c @@ -27,7 +27,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_reserves_get (void *cls, - struct TALER_EXCHANGEDB_Reserve *reserve) + struct TALER_EXCHANGEDB_Reserve *reserve) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -43,7 +43,7 @@ TEH_PG_reserves_get (void *cls, &reserve->gc), GNUNET_PQ_result_spec_end }; - /* Used in #postgres_reserves_get() */ + /* Used in #postgres_reserves_get() */ PREPARE (pg, "reserves_get", "SELECT" diff --git a/src/exchangedb/pg_reserves_get_origin.c b/src/exchangedb/pg_reserves_get_origin.c index fd6c56586..55d3179d1 100644 --- a/src/exchangedb/pg_reserves_get_origin.c +++ b/src/exchangedb/pg_reserves_get_origin.c @@ -50,7 +50,7 @@ TEH_PG_reserves_get_origin ( " wire_source_h_payto" " FROM reserves_in" " WHERE reserve_pub=$1"); - return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, + return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "get_h_wire_source_of_reserve", params, rs); diff --git a/src/exchangedb/pg_reserves_in_insert.c b/src/exchangedb/pg_reserves_in_insert.c index 16d30d41c..e4d1b6e77 100644 --- a/src/exchangedb/pg_reserves_in_insert.c +++ b/src/exchangedb/pg_reserves_in_insert.c @@ -779,7 +779,8 @@ TEH_PG_reserves_in_insert (void *cls, &conflicts[i], &reserve_uuid[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) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, diff --git a/src/exchangedb/pg_reserves_update.c b/src/exchangedb/pg_reserves_update.c index 4a8861020..a76c37c27 100644 --- a/src/exchangedb/pg_reserves_update.c +++ b/src/exchangedb/pg_reserves_update.c @@ -27,7 +27,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_reserves_update (void *cls, - const struct TALER_EXCHANGEDB_Reserve *reserve) + const struct TALER_EXCHANGEDB_Reserve *reserve) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { diff --git a/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.c b/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.c index abddab52f..d24c6245b 100644 --- a/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.c +++ b/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.c @@ -26,8 +26,6 @@ #include "pg_helper.h" - - /** * Closure for #get_kyc_amounts_cb(). */ @@ -112,7 +110,6 @@ get_kyc_amounts_cb (void *cls, } - enum GNUNET_DB_QueryStatus TEH_PG_select_aggregation_amounts_for_kyc_check ( void *cls, diff --git a/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h b/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h index 87fc8677a..b91740581 100644 --- a/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h +++ b/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h @@ -44,4 +44,5 @@ TEH_PG_select_aggregation_amounts_for_kyc_check ( struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); + #endif diff --git a/src/exchangedb/pg_select_aggregation_transient.c b/src/exchangedb/pg_select_aggregation_transient.c index f3e39c532..d8d7ae701 100644 --- a/src/exchangedb/pg_select_aggregation_transient.c +++ b/src/exchangedb/pg_select_aggregation_transient.c @@ -49,7 +49,7 @@ TEH_PG_select_aggregation_transient ( wtid), GNUNET_PQ_result_spec_end }; - /* Used in #postgres_select_aggregation_transient() */ + /* Used in #postgres_select_aggregation_transient() */ PREPARE (pg, "select_aggregation_transient", "SELECT" diff --git a/src/exchangedb/pg_select_auditor_denom_sig.c b/src/exchangedb/pg_select_auditor_denom_sig.c index 90e0c5096..1dd6bd3d1 100644 --- a/src/exchangedb/pg_select_auditor_denom_sig.c +++ b/src/exchangedb/pg_select_auditor_denom_sig.c @@ -64,4 +64,3 @@ TEH_PG_select_auditor_denom_sig ( params, rs); } - diff --git a/src/exchangedb/pg_select_contract.c b/src/exchangedb/pg_select_contract.c index 4f4a525bd..3e6bf22bc 100644 --- a/src/exchangedb/pg_select_contract.c +++ b/src/exchangedb/pg_select_contract.c @@ -27,11 +27,11 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_contract (void *cls, - const struct TALER_ContractDiffiePublicP *pub_ckey, - struct TALER_PurseContractPublicKeyP *purse_pub, - struct TALER_PurseContractSignatureP *econtract_sig, - size_t *econtract_size, - void **econtract) + const struct TALER_ContractDiffiePublicP *pub_ckey, + struct TALER_PurseContractPublicKeyP *purse_pub, + struct TALER_PurseContractSignatureP *econtract_sig, + size_t *econtract_size, + void **econtract) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -49,15 +49,15 @@ TEH_PG_select_contract (void *cls, GNUNET_PQ_result_spec_end }; - /* Used in #postgres_select_contract */ + /* Used in #postgres_select_contract */ PREPARE (pg, - "select_contract", - "SELECT " - " purse_pub" - ",e_contract" - ",contract_sig" - " FROM contracts" - " WHERE pub_ckey=$1;"); + "select_contract", + "SELECT " + " purse_pub" + ",e_contract" + ",contract_sig" + " FROM contracts" + " WHERE pub_ckey=$1;"); return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "select_contract", params, diff --git a/src/exchangedb/pg_select_contract.h b/src/exchangedb/pg_select_contract.h index a503c8da9..747a82753 100644 --- a/src/exchangedb/pg_select_contract.h +++ b/src/exchangedb/pg_select_contract.h @@ -38,10 +38,10 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_select_contract (void *cls, - const struct TALER_ContractDiffiePublicP *pub_ckey, - struct TALER_PurseContractPublicKeyP *purse_pub, - struct TALER_PurseContractSignatureP *econtract_sig, - size_t *econtract_size, + const struct TALER_ContractDiffiePublicP *pub_ckey, + struct TALER_PurseContractPublicKeyP *purse_pub, + struct TALER_PurseContractSignatureP *econtract_sig, + size_t *econtract_size, void **econtract); #endif diff --git a/src/exchangedb/pg_select_contract_by_purse.c b/src/exchangedb/pg_select_contract_by_purse.c index aeeb56d48..8d29b3954 100644 --- a/src/exchangedb/pg_select_contract_by_purse.c +++ b/src/exchangedb/pg_select_contract_by_purse.c @@ -46,7 +46,7 @@ TEH_PG_select_contract_by_purse ( &econtract->econtract_size), GNUNET_PQ_result_spec_end }; - /* Used in #postgres_select_contract_by_purse */ + /* Used in #postgres_select_contract_by_purse */ PREPARE (pg, "select_contract_by_purse", "SELECT " diff --git a/src/exchangedb/pg_select_deposits_missing_wire.c b/src/exchangedb/pg_select_deposits_missing_wire.c index 2a260a369..e638c88e9 100644 --- a/src/exchangedb/pg_select_deposits_missing_wire.c +++ b/src/exchangedb/pg_select_deposits_missing_wire.c @@ -114,10 +114,10 @@ missing_wire_cb (void *cls, enum GNUNET_DB_QueryStatus TEH_PG_select_deposits_missing_wire (void *cls, - struct GNUNET_TIME_Timestamp start_date, - struct GNUNET_TIME_Timestamp end_date, - TALER_EXCHANGEDB_WireMissingCallback cb, - void *cb_cls) + struct GNUNET_TIME_Timestamp start_date, + struct GNUNET_TIME_Timestamp end_date, + TALER_EXCHANGEDB_WireMissingCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -133,11 +133,11 @@ TEH_PG_select_deposits_missing_wire (void *cls, }; enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_select_deposits_missing_wire */ - // FIXME: used by the auditor; can probably be done - // smarter by checking if 'done' or 'blocked' - // are set correctly when going over deposits, instead - // of JOINing with refunds. + /* Used in #postgres_select_deposits_missing_wire */ + // FIXME: used by the auditor; can probably be done + // smarter by checking if 'done' or 'blocked' + // are set correctly when going over deposits, instead + // of JOINing with refunds. PREPARE (pg, "deposits_get_overdue", "SELECT" @@ -164,7 +164,6 @@ TEH_PG_select_deposits_missing_wire (void *cls, " ORDER BY wire_deadline ASC"); - qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, "deposits_get_overdue", params, diff --git a/src/exchangedb/pg_select_deposits_missing_wire.h b/src/exchangedb/pg_select_deposits_missing_wire.h index f702c2417..40c592cee 100644 --- a/src/exchangedb/pg_select_deposits_missing_wire.h +++ b/src/exchangedb/pg_select_deposits_missing_wire.h @@ -38,9 +38,9 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_select_deposits_missing_wire (void *cls, - struct GNUNET_TIME_Timestamp start_date, - struct GNUNET_TIME_Timestamp end_date, - TALER_EXCHANGEDB_WireMissingCallback cb, + struct GNUNET_TIME_Timestamp start_date, + struct GNUNET_TIME_Timestamp end_date, + TALER_EXCHANGEDB_WireMissingCallback cb, void *cb_cls); #endif diff --git a/src/exchangedb/pg_select_history_requests_above_serial_id.c b/src/exchangedb/pg_select_history_requests_above_serial_id.c index 81e038114..36902e0ab 100644 --- a/src/exchangedb/pg_select_history_requests_above_serial_id.c +++ b/src/exchangedb/pg_select_history_requests_above_serial_id.c @@ -113,8 +113,6 @@ history_request_serial_helper_cb (void *cls, } - - enum GNUNET_DB_QueryStatus TEH_PG_select_history_requests_above_serial_id ( void *cls, diff --git a/src/exchangedb/pg_select_merge_amounts_for_kyc_check.c b/src/exchangedb/pg_select_merge_amounts_for_kyc_check.c index 5cb665fa8..b1bdd1450 100644 --- a/src/exchangedb/pg_select_merge_amounts_for_kyc_check.c +++ b/src/exchangedb/pg_select_merge_amounts_for_kyc_check.c @@ -26,7 +26,6 @@ #include "pg_helper.h" - /** * Closure for #get_kyc_amounts_cb(). */ @@ -132,7 +131,7 @@ TEH_PG_select_merge_amounts_for_kyc_check ( }; enum GNUNET_DB_QueryStatus qs; - + PREPARE (pg, "select_kyc_relevant_merge_events", "SELECT" @@ -157,4 +156,3 @@ TEH_PG_select_merge_amounts_for_kyc_check ( return GNUNET_DB_STATUS_HARD_ERROR; return qs; } - diff --git a/src/exchangedb/pg_select_purse_decisions_above_serial_id.c b/src/exchangedb/pg_select_purse_decisions_above_serial_id.c index 2368f2d3e..02e67197b 100644 --- a/src/exchangedb/pg_select_purse_decisions_above_serial_id.c +++ b/src/exchangedb/pg_select_purse_decisions_above_serial_id.c @@ -112,7 +112,6 @@ purse_decision_serial_helper_cb (void *cls, } - enum GNUNET_DB_QueryStatus TEH_PG_select_purse_decisions_above_serial_id ( void *cls, diff --git a/src/exchangedb/pg_select_purse_decisions_above_serial_id.h b/src/exchangedb/pg_select_purse_decisions_above_serial_id.h index 53ab31c80..83168d546 100644 --- a/src/exchangedb/pg_select_purse_decisions_above_serial_id.h +++ b/src/exchangedb/pg_select_purse_decisions_above_serial_id.h @@ -43,4 +43,5 @@ TEH_PG_select_purse_decisions_above_serial_id ( bool refunded, TALER_EXCHANGEDB_PurseDecisionCallback cb, void *cb_cls); + #endif diff --git a/src/exchangedb/pg_select_purse_merge.c b/src/exchangedb/pg_select_purse_merge.c index d1f6a5396..ce9f03618 100644 --- a/src/exchangedb/pg_select_purse_merge.c +++ b/src/exchangedb/pg_select_purse_merge.c @@ -56,7 +56,7 @@ TEH_PG_select_purse_merge ( }; *partner_url = NULL; - /* Used in #postgres_select_purse_merge */ + /* Used in #postgres_select_purse_merge */ PREPARE (pg, "select_purse_merge", "SELECT " diff --git a/src/exchangedb/pg_select_recoup_above_serial_id.c b/src/exchangedb/pg_select_recoup_above_serial_id.c index 9047a86f8..b2933fae3 100644 --- a/src/exchangedb/pg_select_recoup_above_serial_id.c +++ b/src/exchangedb/pg_select_recoup_above_serial_id.c @@ -26,7 +26,6 @@ #include "pg_helper.h" - /** * Closure for #recoup_serial_helper_cb(). */ @@ -137,6 +136,7 @@ recoup_serial_helper_cb (void *cls, } } + enum GNUNET_DB_QueryStatus TEH_PG_select_recoup_above_serial_id ( void *cls, @@ -157,7 +157,7 @@ TEH_PG_select_recoup_above_serial_id ( }; enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_select_recoup_above_serial_id() to obtain recoup transactions */ + /* Used in #postgres_select_recoup_above_serial_id() to obtain recoup transactions */ PREPARE (pg, "recoup_get_incr", "SELECT" diff --git a/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c b/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c index a3f6bc93d..c6fb62cc7 100644 --- a/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c +++ b/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c @@ -141,7 +141,6 @@ recoup_refresh_serial_helper_cb (void *cls, } - enum GNUNET_DB_QueryStatus TEH_PG_select_recoup_refresh_above_serial_id ( void *cls, @@ -162,8 +161,8 @@ TEH_PG_select_recoup_refresh_above_serial_id ( }; enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_select_recoup_refresh_above_serial_id() to obtain - recoup-refresh transactions */ + /* Used in #postgres_select_recoup_refresh_above_serial_id() to obtain + recoup-refresh transactions */ PREPARE (pg, "recoup_refresh_get_incr", "SELECT" diff --git a/src/exchangedb/pg_select_refreshes_above_serial_id.c b/src/exchangedb/pg_select_refreshes_above_serial_id.c index d2b4a7fa6..401e6dcef 100644 --- a/src/exchangedb/pg_select_refreshes_above_serial_id.c +++ b/src/exchangedb/pg_select_refreshes_above_serial_id.c @@ -130,10 +130,6 @@ refreshs_serial_helper_cb (void *cls, } - - - - enum GNUNET_DB_QueryStatus TEH_PG_select_refreshes_above_serial_id ( void *cls, @@ -153,8 +149,8 @@ TEH_PG_select_refreshes_above_serial_id ( .status = GNUNET_OK }; enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_select_refreshes_above_serial_id() to fetch - refresh session with id '\geq' the given parameter */ + /* Used in #postgres_select_refreshes_above_serial_id() to fetch + refresh session with id '\geq' the given parameter */ PREPARE (pg, "audit_get_refresh_commitments_incr", "SELECT" diff --git a/src/exchangedb/pg_select_refunds_by_coin.h b/src/exchangedb/pg_select_refunds_by_coin.h index e1838b235..72df13fda 100644 --- a/src/exchangedb/pg_select_refunds_by_coin.h +++ b/src/exchangedb/pg_select_refunds_by_coin.h @@ -44,4 +44,5 @@ TEH_PG_select_refunds_by_coin ( const struct TALER_PrivateContractHashP *h_contract, TALER_EXCHANGEDB_RefundCoinCallback cb, void *cb_cls); + #endif diff --git a/src/exchangedb/pg_select_reserves_in_above_serial_id.c b/src/exchangedb/pg_select_reserves_in_above_serial_id.c index 1a6efc66b..8dd4a9aba 100644 --- a/src/exchangedb/pg_select_reserves_in_above_serial_id.c +++ b/src/exchangedb/pg_select_reserves_in_above_serial_id.c @@ -137,8 +137,8 @@ TEH_PG_select_reserves_in_above_serial_id ( }; enum GNUNET_DB_QueryStatus qs; - /* Used in postgres_select_reserves_in_above_serial_id() to obtain inbound - transactions for reserves with serial id '\geq' the given parameter */ + /* Used in postgres_select_reserves_in_above_serial_id() to obtain inbound + transactions for reserves with serial id '\geq' the given parameter */ PREPARE (pg, "audit_reserves_in_get_transactions_incr", "SELECT" diff --git a/src/exchangedb/pg_select_reserves_in_above_serial_id_by_account.c b/src/exchangedb/pg_select_reserves_in_above_serial_id_by_account.c index ba73994f0..809df191b 100644 --- a/src/exchangedb/pg_select_reserves_in_above_serial_id_by_account.c +++ b/src/exchangedb/pg_select_reserves_in_above_serial_id_by_account.c @@ -138,8 +138,8 @@ TEH_PG_select_reserves_in_above_serial_id_by_account ( }; enum GNUNET_DB_QueryStatus qs; - /* Used in postgres_select_reserves_in_above_serial_id() to obtain inbound - transactions for reserves with serial id '\geq' the given parameter */ + /* Used in postgres_select_reserves_in_above_serial_id() to obtain inbound + transactions for reserves with serial id '\geq' the given parameter */ PREPARE (pg, "audit_reserves_in_get_transactions_incr_by_account", "SELECT" diff --git a/src/exchangedb/pg_select_wire_out_above_serial_id.c b/src/exchangedb/pg_select_wire_out_above_serial_id.c index e219f5d4b..a9615ac8e 100644 --- a/src/exchangedb/pg_select_wire_out_above_serial_id.c +++ b/src/exchangedb/pg_select_wire_out_above_serial_id.c @@ -113,7 +113,6 @@ wire_out_serial_helper_cb (void *cls, } - enum GNUNET_DB_QueryStatus TEH_PG_select_wire_out_above_serial_id ( void *cls, @@ -133,7 +132,7 @@ TEH_PG_select_wire_out_above_serial_id ( .status = GNUNET_OK }; enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_select_wire_out_above_serial_id() */ + /* Used in #postgres_select_wire_out_above_serial_id() */ PREPARE (pg, "audit_get_wire_incr", "SELECT" diff --git a/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.c b/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.c index 08883c9a4..a6c3f0730 100644 --- a/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.c +++ b/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.c @@ -112,6 +112,7 @@ wire_out_serial_helper_cb (void *cls, } } + enum GNUNET_DB_QueryStatus TEH_PG_select_wire_out_above_serial_id_by_account ( void *cls, @@ -134,7 +135,7 @@ TEH_PG_select_wire_out_above_serial_id_by_account ( }; enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_select_wire_out_above_serial_id_by_account() */ + /* Used in #postgres_select_wire_out_above_serial_id_by_account() */ PREPARE (pg, "audit_get_wire_incr_by_account", "SELECT" diff --git a/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.h b/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.h index 98315cace..04c6a62b2 100644 --- a/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.h +++ b/src/exchangedb/pg_select_wire_out_above_serial_id_by_account.h @@ -43,4 +43,5 @@ TEH_PG_select_wire_out_above_serial_id_by_account ( uint64_t serial_id, TALER_EXCHANGEDB_WireTransferOutCallback cb, void *cb_cls); + #endif diff --git a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c index e200da8de..339fa3e23 100644 --- a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c +++ b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.c @@ -131,21 +131,21 @@ TEH_PG_select_withdraw_amounts_for_kyc_check ( .status = GNUNET_OK }; enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_select_withdraw_amounts_for_kyc_check ( -() */ + /* Used in #postgres_select_withdraw_amounts_for_kyc_check ( + () */ PREPARE (pg, - "select_kyc_relevant_withdraw_events", - "SELECT" - " ro.amount_with_fee_val AS amount_val" - ",ro.amount_with_fee_frac AS amount_frac" - ",ro.execution_date AS date" - " FROM reserves_out ro" - " JOIN reserves_out_by_reserve USING (h_blind_ev)" - " JOIN reserves res ON (ro.reserve_uuid = res.reserve_uuid)" - " JOIN reserves_in ri ON (res.reserve_pub = ri.reserve_pub)" - " WHERE wire_source_h_payto=$1" - " AND ro.execution_date >= $2" - " ORDER BY ro.execution_date DESC"); + "select_kyc_relevant_withdraw_events", + "SELECT" + " ro.amount_with_fee_val AS amount_val" + ",ro.amount_with_fee_frac AS amount_frac" + ",ro.execution_date AS date" + " FROM reserves_out ro" + " JOIN reserves_out_by_reserve USING (h_blind_ev)" + " JOIN reserves res ON (ro.reserve_uuid = res.reserve_uuid)" + " JOIN reserves_in ri ON (res.reserve_pub = ri.reserve_pub)" + " WHERE wire_source_h_payto=$1" + " AND ro.execution_date >= $2" + " ORDER BY ro.execution_date DESC"); qs = GNUNET_PQ_eval_prepared_multi_select ( pg->conn, "select_kyc_relevant_withdraw_events", diff --git a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h index 4c1283744..9a780adbe 100644 --- a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h +++ b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h @@ -44,4 +44,5 @@ TEH_PG_select_withdraw_amounts_for_kyc_check ( struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); + #endif diff --git a/src/exchangedb/pg_select_withdrawals_above_serial_id.c b/src/exchangedb/pg_select_withdrawals_above_serial_id.c index 4718a62ae..b842b11aa 100644 --- a/src/exchangedb/pg_select_withdrawals_above_serial_id.c +++ b/src/exchangedb/pg_select_withdrawals_above_serial_id.c @@ -121,7 +121,6 @@ reserves_out_serial_helper_cb (void *cls, } - enum GNUNET_DB_QueryStatus TEH_PG_select_withdrawals_above_serial_id ( void *cls, @@ -142,7 +141,7 @@ TEH_PG_select_withdrawals_above_serial_id ( }; enum GNUNET_DB_QueryStatus qs; - /* Fetch deposits with rowid '\geq' the given parameter */ + /* Fetch deposits with rowid '\geq' the given parameter */ PREPARE (pg, "audit_get_reserves_out_incr", diff --git a/src/exchangedb/pg_select_withdrawals_above_serial_id.h b/src/exchangedb/pg_select_withdrawals_above_serial_id.h index adc23fb30..2b741a3b4 100644 --- a/src/exchangedb/pg_select_withdrawals_above_serial_id.h +++ b/src/exchangedb/pg_select_withdrawals_above_serial_id.h @@ -41,4 +41,5 @@ TEH_PG_select_withdrawals_above_serial_id ( uint64_t serial_id, TALER_EXCHANGEDB_WithdrawCallback cb, void *cb_cls); + #endif diff --git a/src/exchangedb/pg_set_extension_manifest.c b/src/exchangedb/pg_set_extension_manifest.c index 86e9d3f08..c7db04312 100644 --- a/src/exchangedb/pg_set_extension_manifest.c +++ b/src/exchangedb/pg_set_extension_manifest.c @@ -28,8 +28,8 @@ enum GNUNET_DB_QueryStatus TEH_PG_set_extension_manifest (void *cls, - const char *extension_name, - const char *manifest) + const char *extension_name, + const char *manifest) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam pcfg = diff --git a/src/exchangedb/pg_set_extension_manifest.h b/src/exchangedb/pg_set_extension_manifest.h index ead3abd28..0befeedd8 100644 --- a/src/exchangedb/pg_set_extension_manifest.h +++ b/src/exchangedb/pg_set_extension_manifest.h @@ -37,7 +37,7 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_set_extension_manifest (void *cls, - const char *extension_name, + const char *extension_name, const char *manifest); #endif diff --git a/src/exchangedb/pg_set_purse_balance.c b/src/exchangedb/pg_set_purse_balance.c index a996104bc..e955cb1cb 100644 --- a/src/exchangedb/pg_set_purse_balance.c +++ b/src/exchangedb/pg_set_purse_balance.c @@ -50,6 +50,3 @@ TEH_PG_set_purse_balance ( "set_purse_balance", params); } - - - diff --git a/src/exchangedb/pg_setup_wire_target.c b/src/exchangedb/pg_setup_wire_target.c index a2d890c50..ed6fbe338 100644 --- a/src/exchangedb/pg_setup_wire_target.c +++ b/src/exchangedb/pg_setup_wire_target.c @@ -26,7 +26,7 @@ enum GNUNET_DB_QueryStatus -TEH_PG_setup_wire_target( +TEH_PG_setup_wire_target ( struct PostgresClosure *pg, const char *payto_uri, struct TALER_PaytoHashP *h_payto) diff --git a/src/exchangedb/pg_setup_wire_target.h b/src/exchangedb/pg_setup_wire_target.h index 12c0e59b0..77512a600 100644 --- a/src/exchangedb/pg_setup_wire_target.h +++ b/src/exchangedb/pg_setup_wire_target.h @@ -35,7 +35,7 @@ * @return transaction status */ enum GNUNET_DB_QueryStatus -TEH_PG_setup_wire_target( +TEH_PG_setup_wire_target ( struct PostgresClosure *pg, const char *payto_uri, struct TALER_PaytoHashP *h_payto); diff --git a/src/exchangedb/pg_store_wire_transfer_out.c b/src/exchangedb/pg_store_wire_transfer_out.c index 8bc0147dd..b8b0bb692 100644 --- a/src/exchangedb/pg_store_wire_transfer_out.c +++ b/src/exchangedb/pg_store_wire_transfer_out.c @@ -44,7 +44,7 @@ TEH_PG_store_wire_transfer_out ( GNUNET_PQ_query_param_end }; - /* Used in #postgres_store_wire_transfer_out */ + /* Used in #postgres_store_wire_transfer_out */ PREPARE (pg, "insert_wire_out", "INSERT INTO wire_out " diff --git a/src/exchangedb/pg_update_aggregation_transient.c b/src/exchangedb/pg_update_aggregation_transient.c index 1d91301c3..c44cd67ec 100644 --- a/src/exchangedb/pg_update_aggregation_transient.c +++ b/src/exchangedb/pg_update_aggregation_transient.c @@ -26,7 +26,6 @@ #include "pg_helper.h" - enum GNUNET_DB_QueryStatus TEH_PG_update_aggregation_transient ( void *cls, @@ -45,7 +44,7 @@ TEH_PG_update_aggregation_transient ( }; - /* Used in #postgres_update_aggregation_transient() */ + /* Used in #postgres_update_aggregation_transient() */ PREPARE (pg, "update_aggregation_transient", "UPDATE aggregation_transient" diff --git a/src/exchangedb/pg_update_auditor.c b/src/exchangedb/pg_update_auditor.c index 9d82f25db..167a270b9 100644 --- a/src/exchangedb/pg_update_auditor.c +++ b/src/exchangedb/pg_update_auditor.c @@ -28,11 +28,11 @@ enum GNUNET_DB_QueryStatus TEH_PG_update_auditor (void *cls, - const struct TALER_AuditorPublicKeyP *auditor_pub, - const char *auditor_url, - const char *auditor_name, - struct GNUNET_TIME_Timestamp change_date, - bool enabled) + const struct TALER_AuditorPublicKeyP *auditor_pub, + const char *auditor_url, + const char *auditor_name, + struct GNUNET_TIME_Timestamp change_date, + bool enabled) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -43,16 +43,16 @@ TEH_PG_update_auditor (void *cls, GNUNET_PQ_query_param_timestamp (&change_date), GNUNET_PQ_query_param_end }; - /* used in #postgres_update_auditor() */ - PREPARE(pg, - "update_auditor", - "UPDATE auditors" - " SET" - " auditor_url=$2" - " ,auditor_name=$3" - " ,is_active=$4" - " ,last_change=$5" - " WHERE auditor_pub=$1"); + /* used in #postgres_update_auditor() */ + PREPARE (pg, + "update_auditor", + "UPDATE auditors" + " SET" + " auditor_url=$2" + " ,auditor_name=$3" + " ,is_active=$4" + " ,last_change=$5" + " WHERE auditor_pub=$1"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "update_auditor", params); diff --git a/src/exchangedb/pg_update_auditor.h b/src/exchangedb/pg_update_auditor.h index af8d06062..ee869f8b7 100644 --- a/src/exchangedb/pg_update_auditor.h +++ b/src/exchangedb/pg_update_auditor.h @@ -38,10 +38,10 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_update_auditor (void *cls, - const struct TALER_AuditorPublicKeyP *auditor_pub, - const char *auditor_url, - const char *auditor_name, - struct GNUNET_TIME_Timestamp change_date, + const struct TALER_AuditorPublicKeyP *auditor_pub, + const char *auditor_url, + const char *auditor_name, + struct GNUNET_TIME_Timestamp change_date, bool enabled); #endif diff --git a/src/exchangedb/pg_update_wire.c b/src/exchangedb/pg_update_wire.c index f5f5672cb..4059348c9 100644 --- a/src/exchangedb/pg_update_wire.c +++ b/src/exchangedb/pg_update_wire.c @@ -28,9 +28,9 @@ enum GNUNET_DB_QueryStatus TEH_PG_update_wire (void *cls, - const char *payto_uri, - struct GNUNET_TIME_Timestamp change_date, - bool enabled) + const char *payto_uri, + struct GNUNET_TIME_Timestamp change_date, + bool enabled) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -40,7 +40,7 @@ TEH_PG_update_wire (void *cls, GNUNET_PQ_query_param_end }; - /* used in #postgres_update_wire() */ + /* used in #postgres_update_wire() */ PREPARE (pg, "update_wire", "UPDATE wire_accounts" diff --git a/src/exchangedb/pg_update_wire.h b/src/exchangedb/pg_update_wire.h index c01d68a46..67038b580 100644 --- a/src/exchangedb/pg_update_wire.h +++ b/src/exchangedb/pg_update_wire.h @@ -36,8 +36,8 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_update_wire (void *cls, - const char *payto_uri, - struct GNUNET_TIME_Timestamp change_date, + const char *payto_uri, + struct GNUNET_TIME_Timestamp change_date, bool enabled); #endif diff --git a/src/exchangedb/pg_wire_prepare_data_get.c b/src/exchangedb/pg_wire_prepare_data_get.c index d45413010..21d1b947a 100644 --- a/src/exchangedb/pg_wire_prepare_data_get.c +++ b/src/exchangedb/pg_wire_prepare_data_get.c @@ -99,10 +99,10 @@ prewire_cb (void *cls, enum GNUNET_DB_QueryStatus TEH_PG_wire_prepare_data_get (void *cls, - uint64_t start_row, - uint64_t limit, - TALER_EXCHANGEDB_WirePreparationIterator cb, - void *cb_cls) + uint64_t start_row, + uint64_t limit, + TALER_EXCHANGEDB_WirePreparationIterator cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -118,7 +118,7 @@ TEH_PG_wire_prepare_data_get (void *cls, enum GNUNET_DB_QueryStatus qs; - /* Used in #postgres_wire_prepare_data_get() */ + /* Used in #postgres_wire_prepare_data_get() */ PREPARE (pg, "wire_prepare_data_get", "SELECT" diff --git a/src/exchangedb/pg_wire_prepare_data_get.h b/src/exchangedb/pg_wire_prepare_data_get.h index 91e21d27e..815c14bdf 100644 --- a/src/exchangedb/pg_wire_prepare_data_get.h +++ b/src/exchangedb/pg_wire_prepare_data_get.h @@ -38,8 +38,9 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_wire_prepare_data_get (void *cls, - uint64_t start_row, - uint64_t limit, - TALER_EXCHANGEDB_WirePreparationIterator cb, + uint64_t start_row, + uint64_t limit, + TALER_EXCHANGEDB_WirePreparationIterator cb, void *cb_cls); + #endif diff --git a/src/exchangedb/pg_wire_prepare_data_insert.c b/src/exchangedb/pg_wire_prepare_data_insert.c index 903f22a5b..919fccdaf 100644 --- a/src/exchangedb/pg_wire_prepare_data_insert.c +++ b/src/exchangedb/pg_wire_prepare_data_insert.c @@ -27,9 +27,9 @@ enum GNUNET_DB_QueryStatus TEH_PG_wire_prepare_data_insert (void *cls, - const char *type, - const char *buf, - size_t buf_size) + const char *type, + const char *buf, + size_t buf_size) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -39,15 +39,15 @@ TEH_PG_wire_prepare_data_insert (void *cls, }; - /* Used in #postgres_wire_prepare_data_insert() to store - wire transfer information before actually committing it with the bank */ + /* Used in #postgres_wire_prepare_data_insert() to store + wire transfer information before actually committing it with the bank */ PREPARE (pg, - "wire_prepare_data_insert", - "INSERT INTO prewire " - "(wire_method" - ",buf" - ") VALUES " - "($1, $2);"); + "wire_prepare_data_insert", + "INSERT INTO prewire " + "(wire_method" + ",buf" + ") VALUES " + "($1, $2);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "wire_prepare_data_insert", params); diff --git a/src/exchangedb/pg_wire_prepare_data_insert.h b/src/exchangedb/pg_wire_prepare_data_insert.h index 2b6050d05..e73ee152d 100644 --- a/src/exchangedb/pg_wire_prepare_data_insert.h +++ b/src/exchangedb/pg_wire_prepare_data_insert.h @@ -36,7 +36,8 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_wire_prepare_data_insert (void *cls, - const char *type, - const char *buf, + const char *type, + const char *buf, size_t buf_size); + #endif diff --git a/src/exchangedb/pg_wire_prepare_data_mark_failed.c b/src/exchangedb/pg_wire_prepare_data_mark_failed.c index fe2236b82..4e4d729a3 100644 --- a/src/exchangedb/pg_wire_prepare_data_mark_failed.c +++ b/src/exchangedb/pg_wire_prepare_data_mark_failed.c @@ -37,7 +37,7 @@ TEH_PG_wire_prepare_data_mark_failed ( GNUNET_PQ_query_param_end }; - /* Used in #postgres_wire_prepare_data_mark_failed() */ + /* Used in #postgres_wire_prepare_data_mark_failed() */ PREPARE (pg, "wire_prepare_data_mark_failed", diff --git a/src/exchangedb/pg_wire_prepare_data_mark_failed.h b/src/exchangedb/pg_wire_prepare_data_mark_failed.h index cae1523d1..98846b284 100644 --- a/src/exchangedb/pg_wire_prepare_data_mark_failed.h +++ b/src/exchangedb/pg_wire_prepare_data_mark_failed.h @@ -36,4 +36,5 @@ enum GNUNET_DB_QueryStatus TEH_PG_wire_prepare_data_mark_failed ( void *cls, uint64_t rowid); + #endif diff --git a/src/exchangedb/pg_wire_prepare_data_mark_finished.c b/src/exchangedb/pg_wire_prepare_data_mark_finished.c index de8738e40..af4a0fbbb 100644 --- a/src/exchangedb/pg_wire_prepare_data_mark_finished.c +++ b/src/exchangedb/pg_wire_prepare_data_mark_finished.c @@ -36,12 +36,12 @@ TEH_PG_wire_prepare_data_mark_finished ( GNUNET_PQ_query_param_end }; - /* Used in #postgres_wire_prepare_data_mark_finished() */ + /* Used in #postgres_wire_prepare_data_mark_finished() */ PREPARE (pg, - "wire_prepare_data_mark_done", - "UPDATE prewire" - " SET finished=TRUE" - " WHERE prewire_uuid=$1;"); + "wire_prepare_data_mark_done", + "UPDATE prewire" + " SET finished=TRUE" + " WHERE prewire_uuid=$1;"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "wire_prepare_data_mark_done", diff --git a/src/exchangedb/pg_wire_prepare_data_mark_finished.h b/src/exchangedb/pg_wire_prepare_data_mark_finished.h index 19db2ca99..ba2e384cd 100644 --- a/src/exchangedb/pg_wire_prepare_data_mark_finished.h +++ b/src/exchangedb/pg_wire_prepare_data_mark_finished.h @@ -36,4 +36,5 @@ enum GNUNET_DB_QueryStatus TEH_PG_wire_prepare_data_mark_finished ( void *cls, uint64_t rowid); + #endif diff --git a/src/exchangedb/test_exchangedb_by_j.c b/src/exchangedb/test_exchangedb_by_j.c index 9769d964b..24b24d5b0 100644 --- a/src/exchangedb/test_exchangedb_by_j.c +++ b/src/exchangedb/test_exchangedb_by_j.c @@ -74,8 +74,8 @@ static void run (void *cls) { static const unsigned int batches[] = {1, 2, 3, 4, 8, 16 }; - struct GNUNET_TIME_Relative times[sizeof (batches)/sizeof(*batches)]; - unsigned long long sqrs[sizeof (batches)/sizeof(*batches)]; + struct GNUNET_TIME_Relative times[sizeof (batches) / sizeof(*batches)]; + unsigned long long sqrs[sizeof (batches) / sizeof(*batches)]; struct GNUNET_CONFIGURATION_Handle *cfg = cls; const uint32_t num_partitions = 10; @@ -101,74 +101,75 @@ run (void *cls) memset (times, 0, sizeof (times)); memset (sqrs, 0, sizeof (sqrs)); for (unsigned int r = 0; r < ROUNDS; r++) - { + { for (unsigned int i = 0; i< 6; i++) + { + const char *sndr = "payto://x-taler-bank/localhost:8080/1"; + struct TALER_Amount value; + unsigned int batch_size = batches[i]; + unsigned int iterations = 16; // 1024*10; + struct TALER_ReservePublicKeyP reserve_pubs[iterations]; + struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Timestamp ts; + struct GNUNET_TIME_Relative duration; + struct TALER_EXCHANGEDB_ReserveInInfo reserves[iterations]; + enum GNUNET_DB_QueryStatus results[iterations]; + unsigned long long duration_sq; + + GNUNET_assert (GNUNET_OK == + TALER_string_to_amount (CURRENCY ":1.000010", + &value)); + now = GNUNET_TIME_absolute_get (); + ts = GNUNET_TIME_timestamp_get (); + for (unsigned int r = 0; rbatch2_reserves_in_insert (plugin->cls, - reserves, - iterations, - batch_size, - results)); - duration = GNUNET_TIME_absolute_get_duration (now); - times[i] = GNUNET_TIME_relative_add (times[i], - duration); - 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]); - sqrs[i] += duration_sq; - fprintf (stdout, - "for a batchsize equal to %d it took %s\n", - batch_size, - GNUNET_STRINGS_relative_time_to_string (duration, - GNUNET_NO) ); - - system ("./test.sh"); //DELETE AFTER TIMER + RND_BLK (&reserve_pubs[r]); + reserves[r].reserve_pub = &reserve_pubs[r]; + reserves[r].balance = &value; + reserves[r].execution_time = ts; + reserves[r].sender_account_details = sndr; + reserves[r].exchange_account_name = "name"; + reserves[r].wire_reference = r; } - } - for (unsigned int i = 0; i< 6; i++) - { - struct GNUNET_TIME_Relative avg; - double avg_dbl; - double variance; + FAILIF (iterations != + plugin->batch2_reserves_in_insert (plugin->cls, + reserves, + iterations, + batch_size, + results)); + duration = GNUNET_TIME_absolute_get_duration (now); + times[i] = GNUNET_TIME_relative_add (times[i], + duration); + 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]); + sqrs[i] += duration_sq; + fprintf (stdout, + "for a batchsize equal to %d it took %s\n", + batch_size, + GNUNET_STRINGS_relative_time_to_string (duration, + GNUNET_NO) ); - avg = GNUNET_TIME_relative_divide (times[i], - ROUNDS); - avg_dbl = avg.rel_value_us; - variance = sqrs[i] - (avg_dbl * avg_dbl * ROUNDS); - fprintf(stdout, - "Batch[%2u]: %8llu ± %6.0f\n", - batches[i], - (unsigned long long) avg.rel_value_us, - sqrt (variance / (ROUNDS-1))); + system ("./test.sh"); // DELETE AFTER TIMER } + } + for (unsigned int i = 0; i< 6; i++) + { + struct GNUNET_TIME_Relative avg; + double avg_dbl; + double variance; + + avg = GNUNET_TIME_relative_divide (times[i], + ROUNDS); + avg_dbl = avg.rel_value_us; + variance = sqrs[i] - (avg_dbl * avg_dbl * ROUNDS); + fprintf (stdout, + "Batch[%2u]: %8llu ± %6.0f\n", + batches[i], + (unsigned long long) avg.rel_value_us, + sqrt (variance / (ROUNDS - 1))); + } result = 0; drop: diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index cee8fb883..30d48833c 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -29,19 +29,17 @@ #include "taler_extensions_policy.h" - - struct TALER_EXCHANGEDB_CoinInfo { - uint64_t *known_coin_id; - struct TALER_DenominationHashP *denom_hash; - struct TALER_AgeCommitmentHash *h_age_commitment; - bool *existed; + uint64_t known_coin_id; + struct TALER_DenominationHashP denom_hash; + struct TALER_AgeCommitmentHash h_age_commitment; + bool existed; + bool denom_conflict; + bool age_conflict; }; - - /** * Information about a denomination key. */ @@ -900,21 +898,6 @@ struct TALER_EXCHANGEDB_DenominationKeyMetaData }; - - - - - - - - - - - - - - - /** * Signature of a function called with information about the exchange's * denomination keys. @@ -4055,10 +4038,10 @@ struct TALER_EXCHANGEDB_Plugin struct TALER_DenominationHashP *denom_pub_hash, struct TALER_AgeCommitmentHash *age_hash); - enum TALER_EXCHANGEDB_CoinKnownStatus + enum GNUNET_DB_QueryStatus (*batch_ensure_coin_known)(void *cls, const struct TALER_CoinPublicInfo *coin, - const struct + struct TALER_EXCHANGEDB_CoinInfo *result, unsigned int coin_length, unsigned int batch_size);