diff options
Diffstat (limited to 'src/exchangedb')
| -rw-r--r-- | src/exchangedb/irbt_callbacks.c | 37 | ||||
| -rw-r--r-- | src/exchangedb/lrbt_callbacks.c | 6 | ||||
| -rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 131 | 
3 files changed, 170 insertions, 4 deletions
| diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c index 703f0f32..036ed2eb 100644 --- a/src/exchangedb/irbt_callbacks.c +++ b/src/exchangedb/irbt_callbacks.c @@ -37,12 +37,40 @@ irbt_cb_table_denominations (struct PostgresClosure *pg,                               struct TALER_EXCHANGEDB_Session *session,                               const struct TALER_EXCHANGEDB_TableData *td)  { +  struct GNUNET_HashCode denom_hash;    struct GNUNET_PQ_QueryParam params[] = {      GNUNET_PQ_query_param_uint64 (&td->serial), +    GNUNET_PQ_query_param_auto_from_type (&denom_hash), +    GNUNET_PQ_query_param_rsa_public_key ( +      td->details.denominations.denom_pub.rsa_public_key), +    // GNUNET_PQ_query_param_auto_from_type (&master_pub), // FIXME: !? +    GNUNET_PQ_query_param_auto_from_type ( +      &td->details.denominations.master_sig), +    TALER_PQ_query_param_absolute_time ( +      &td->details.denominations.valid_from), +    TALER_PQ_query_param_absolute_time ( +      &td->details.denominations.expire_withdraw), +    TALER_PQ_query_param_absolute_time ( +      &td->details.denominations.expire_deposit), +    TALER_PQ_query_param_absolute_time ( +      &td->details.denominations.expire_legal), +    TALER_PQ_query_param_amount (&td->details.denominations.coin), +    TALER_PQ_query_param_amount ( +      &td->details.denominations.fee_withdraw), +    TALER_PQ_query_param_amount ( +      &td->details.denominations.fee_deposit), +    TALER_PQ_query_param_amount ( +      &td->details.denominations.fee_refresh), +    TALER_PQ_query_param_amount ( +      &td->details.denominations.fee_refund),      GNUNET_PQ_query_param_end    };    (void) pg; +  GNUNET_CRYPTO_rsa_public_key_hash ( +    td->details.denominations.denom_pub.rsa_public_key, +    &denom_hash); +    return GNUNET_PQ_eval_prepared_non_select (session->conn,                                               "insert_into_table_denominations",                                               params); @@ -64,6 +92,10 @@ irbt_cb_table_denomination_revocations (struct PostgresClosure *pg,  {    struct GNUNET_PQ_QueryParam params[] = {      GNUNET_PQ_query_param_uint64 (&td->serial), +    GNUNET_PQ_query_param_auto_from_type ( +      &td->details.denomination_revocations.master_sig), +    GNUNET_PQ_query_param_uint64 ( +      &td->details.denomination_revocations.denominations_serial),      GNUNET_PQ_query_param_end    }; @@ -88,6 +120,11 @@ irbt_cb_table_reserves (struct PostgresClosure *pg,  {    struct GNUNET_PQ_QueryParam params[] = {      GNUNET_PQ_query_param_uint64 (&td->serial), +    GNUNET_PQ_query_param_auto_from_type (&td->details.reserves.reserve_pub), +    GNUNET_PQ_query_param_string (td->details.reserves.account_details), +    TALER_PQ_query_param_amount (&td->details.reserves.current_balance), +    TALER_PQ_query_param_absolute_time (&td->details.reserves.expiration_date), +    TALER_PQ_query_param_absolute_time (&td->details.reserves.gc_date),      GNUNET_PQ_query_param_end    }; diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c index c840b1bd..1dfa4241 100644 --- a/src/exchangedb/lrbt_callbacks.c +++ b/src/exchangedb/lrbt_callbacks.c @@ -114,9 +114,9 @@ lrbt_cb_table_denomination_revocations (void *cls,      struct GNUNET_PQ_ResultSpec rs[] = {        GNUNET_PQ_result_spec_uint64 ("serial",                                      &td.serial), -      GNUNET_PQ_result_spec_auto_from_type ( -        "denom_pub_hash", -        &td.details.denomination_revocations.denom_pub_hash), +      GNUNET_PQ_result_spec_uint64 ( +        "denominations_serial", +        &td.details.denomination_revocations.denominations_serial),        GNUNET_PQ_result_spec_auto_from_type (          "master_sig",          &td.details.denomination_revocations.master_sig), diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 679eb0ab..b88524fc 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1752,6 +1752,22 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_denominations",                                "SELECT"                                " denominations_serial AS serial" +                              ",denom_pub" +                              ",master_sig" +                              ",valid_from" +                              ",expire_withdraw" +                              ",expire_deposit" +                              ",expire_legal" +                              ",coin_val" +                              ",coin_frac" +                              ",fee_withdraw_val" +                              ",fee_withdraw_frac" +                              ",fee_deposit_val" +                              ",fee_deposit_frac" +                              ",fee_refresh_val" +                              ",fee_refresh_frac" +                              ",fee_refund_val" +                              ",fee_refund_frac"                                " FROM denominations"                                " ORDER BY denominations_serial DESC"                                " LIMIT 1;", @@ -1759,6 +1775,8 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_denomination_revocations",                                "SELECT"                                " denom_revocations_serial_id AS serial" +                              ",master_sig" +                              ",denominations_serial"                                " FROM denomination_revocations"                                " ORDER BY denom_revocations_serial_id DESC"                                " LIMIT 1;", @@ -1766,6 +1784,12 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_reserves",                                "SELECT"                                " reserve_uuid AS serial" +                              ",reserve_pub" +                              ",account_details" +                              ",current_balance_val" +                              ",current_balance_frac" +                              ",expiration_date" +                              ",gc_date"                                " FROM reserves"                                " ORDER BY reserve_uuid DESC"                                " LIMIT 1;", @@ -1773,6 +1797,13 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_reserves_in",                                "SELECT"                                " reserve_in_serial_id AS serial" +                              ",wire_reference" +                              ",credit_val" +                              ",credit_frac" +                              ",sender_account_details" +                              ",exchange_account_section" +                              ",execution_date" +                              ",reserve_uuid"                                " FROM reserves_in"                                " ORDER BY reserve_in_serial_id DESC"                                " LIMIT 1;", @@ -1780,6 +1811,14 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_reserves_close",                                "SELECT"                                " close_uuid AS serial" +                              ",execution_date" +                              ",wtid" +                              ",receiver_account" +                              ",amount_val" +                              ",amount_frac" +                              ",closing_fee_val" +                              ",closing_fee_frac" +                              ",reserve_uuid"                                " FROM reserves_close"                                " ORDER BY close_uuid DESC"                                " LIMIT 1;", @@ -1787,6 +1826,14 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_reserves_out",                                "SELECT"                                " reserve_out_serial_id AS serial" +                              ",h_blind_ev" +                              ",denom_sig" +                              ",reserve_sig" +                              ",execution_date" +                              ",amount_with_fee_val" +                              ",amount_with_fee_frac" +                              ",reserve_uuid" +                              ",denominations_serial"                                " FROM reserves_out"                                " ORDER BY reserve_out_serial_id DESC"                                " LIMIT 1;", @@ -1794,6 +1841,11 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_auditors",                                "SELECT"                                " auditor_uuid AS serial" +                              ",auditor_pub" +                              ",auditor_name" +                              ",auditor_url" +                              ",is_active" +                              ",last_change"                                " FROM auditors"                                " ORDER BY auditor_uuid DESC"                                " LIMIT 1;", @@ -1801,6 +1853,9 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_auditor_denom_sigs",                                "SELECT"                                " auditor_denom_serial AS serial" +                              ",auditor_uuid" +                              ",denominations_serial" +                              ",auditor_sig"                                " FROM auditor_denom_sigs"                                " ORDER BY auditor_denom_serial DESC"                                " LIMIT 1;", @@ -1808,6 +1863,11 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_exchange_sign_keys",                                "SELECT"                                " esk_serial AS serial" +                              ",exchange_pub" +                              ",master_sig" +                              ",valid_from" +                              ",expire_sign" +                              ",expire_legal"                                " FROM exchange_sign_keys"                                " ORDER BY esk_serial DESC"                                " LIMIT 1;", @@ -1815,6 +1875,8 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_signkey_revocations",                                "SELECT"                                " signkey_revocations_serial_id AS serial" +                              ",esk_serial" +                              ",master_sig"                                " FROM signkey_revocations"                                " ORDER BY signkey_revocations_serial_id DESC"                                " LIMIT 1;", @@ -1822,6 +1884,9 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_known_coins",                                "SELECT"                                " known_coin_id AS serial" +                              ",coin_pub" +                              ",denom_sig" +                              ",denominations_serial"                                " FROM known_coins"                                " ORDER BY known_coin_id DESC"                                " LIMIT 1;", @@ -1829,6 +1894,12 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_refresh_commitments",                                "SELECT"                                " melt_serial_id AS serial" +                              ",rc" +                              ",old_coin_sig" +                              ",amount_with_fee_val" +                              ",amount_with_fee_frac" +                              ",noreveal_index" +                              ",old_known_coin_id"                                " FROM refresh_commitments"                                " ORDER BY melt_serial_id DESC"                                " LIMIT 1;", @@ -1836,6 +1907,12 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_refresh_revealed_coins",                                "SELECT"                                " rrc_serial AS serial" +                              ",freshcoin_index" +                              ",link_sig" +                              ",coin_ev" +                              ",ev_sig" +                              ",denominations_serial" +                              ",melt_serial_id"                                " FROM refresh_revealed_coins"                                " ORDER BY rrc_serial DESC"                                " LIMIT 1;", @@ -1843,6 +1920,9 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_refresh_transfer_keys",                                "SELECT"                                " rtc_serial AS serial" +                              ",transfer_pub" +                              ",transfer_privs" +                              ",melt_serial_id"                                " FROM refresh_transfer_keys"                                " ORDER BY rtc_serial DESC"                                " LIMIT 1;", @@ -1850,6 +1930,19 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_deposits",                                "SELECT"                                " deposit_serial_id AS serial" +                              ",amount_with_fee_val" +                              ",amount_with_fee_frac" +                              ",wallet_timestamp" +                              ",exchange_timestamp" +                              ",refund_deadline" +                              ",wire_deadline" +                              ",merchant_pub" +                              ",h_contract_terms" +                              ",coin_sig" +                              ",wire" +                              ",tiny" +                              ",done" +                              ",known_coin_id"                                " FROM deposits"                                " ORDER BY deposit_serial_id DESC"                                " LIMIT 1;", @@ -1857,6 +1950,11 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_refunds",                                "SELECT"                                " refund_serial_id AS serial" +                              ",merchant_sig" +                              ",rtransaction_id" +                              ",amount_with_fee_val" +                              ",amount_with_fee_frac" +                              ",deposit_serial_id"                                " FROM refunds"                                " ORDER BY refund_serial_id DESC"                                " LIMIT 1;", @@ -1864,6 +1962,12 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_wire_out",                                "SELECT"                                " wireout_uuid AS serial" +                              ",execution_date" +                              ",wtid_raw" +                              ",wire_target" +                              ",exchange_account_section" +                              ",amount_val" +                              ",amount_frac"                                " FROM wire_out"                                " ORDER BY wireout_uuid DESC"                                " LIMIT 1;", @@ -1871,6 +1975,8 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_aggregation_tracking",                                "SELECT"                                " aggregation_serial_id AS serial" +                              ",deposit_serial_id" +                              ",wtid_raw"                                " FROM aggregation_tracking"                                " ORDER BY aggregation_serial_id DESC"                                " LIMIT 1;", @@ -1878,6 +1984,14 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_wire_fee",                                "SELECT"                                " wire_fee_serial AS serial" +                              ",wire_method" +                              ",start_date" +                              ",end_date" +                              ",wire_fee_val" +                              ",wire_fee_frac" +                              ",closing_fee_val" +                              ",closing_fee_frac" +                              ",master_sig"                                " FROM wire_fee"                                " ORDER BY wire_fee_serial DESC"                                " LIMIT 1;", @@ -1885,6 +1999,13 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_recoup",                                "SELECT"                                " recoup_uuid AS serial" +                              ",coin_sig" +                              ",coin_blind" +                              ",amount_val" +                              ",amount_frac" +                              ",timestamp" +                              ",known_coin_id" +                              ",reserve_out_serial_id"                                " FROM recoup"                                " ORDER BY recoup_uuid DESC"                                " LIMIT 1;", @@ -1892,6 +2013,13 @@ postgres_get_session (void *cls)        GNUNET_PQ_make_prepare ("select_serial_by_table_recoup_refresh",                                "SELECT"                                " recoup_refresh_uuid AS serial" +                              ",coin_sig" +                              ",coin_blind" +                              ",amount_val" +                              ",amount_frac" +                              ",timestamp" +                              ",known_coin_id" +                              ",rrc_serial"                                " FROM recoup_refresh"                                " ORDER BY recoup_refresh_uuid DESC"                                " LIMIT 1;", @@ -3414,7 +3542,8 @@ postgres_reserves_in_insert (void *cls,         before adding the actual transaction to "reserves_in", as         for a new reserve it can't be a duplicate 'add' operation,         and as the 'add' operation may need the reserve entry -       as a foreign key. */struct GNUNET_PQ_QueryParam params[] = { +       as a foreign key. */ +    struct GNUNET_PQ_QueryParam params[] = {        GNUNET_PQ_query_param_auto_from_type (reserve_pub),        GNUNET_PQ_query_param_string (sender_account_details),        TALER_PQ_query_param_amount (balance), | 
