-update to latest GNUNET_PQ_make_prepare() API
This commit is contained in:
parent
3036c21283
commit
3b34acdb72
@ -157,28 +157,24 @@ setup_connection (struct PostgresClosure *pg)
|
||||
struct GNUNET_PQ_PreparedStatement ps[] = {
|
||||
/* used in #postgres_commit */
|
||||
GNUNET_PQ_make_prepare ("do_commit",
|
||||
"COMMIT",
|
||||
0),
|
||||
"COMMIT"),
|
||||
/* used in #postgres_insert_exchange */
|
||||
GNUNET_PQ_make_prepare ("auditor_insert_exchange",
|
||||
"INSERT INTO auditor_exchanges "
|
||||
"(master_pub"
|
||||
",exchange_url"
|
||||
") VALUES ($1,$2);",
|
||||
2),
|
||||
") VALUES ($1,$2);"),
|
||||
/* used in #postgres_delete_exchange */
|
||||
GNUNET_PQ_make_prepare ("auditor_delete_exchange",
|
||||
"DELETE"
|
||||
" FROM auditor_exchanges"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* used in #postgres_list_exchanges */
|
||||
GNUNET_PQ_make_prepare ("auditor_list_exchanges",
|
||||
"SELECT"
|
||||
" master_pub"
|
||||
",exchange_url"
|
||||
" FROM auditor_exchanges",
|
||||
0),
|
||||
" FROM auditor_exchanges"),
|
||||
/* used in #postgres_insert_exchange_signkey */
|
||||
GNUNET_PQ_make_prepare ("auditor_insert_exchange_signkey",
|
||||
"INSERT INTO auditor_exchange_signkeys "
|
||||
@ -188,8 +184,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",ep_end"
|
||||
",exchange_pub"
|
||||
",master_sig"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6);",
|
||||
6),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6);"),
|
||||
/* Used in #postgres_insert_deposit_confirmation() */
|
||||
GNUNET_PQ_make_prepare ("auditor_deposit_confirmation_insert",
|
||||
"INSERT INTO deposit_confirmations "
|
||||
@ -207,8 +202,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",exchange_sig"
|
||||
",exchange_pub"
|
||||
",master_sig" /* master_sig could be normalized... */
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14);",
|
||||
14),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14);"),
|
||||
/* Used in #postgres_get_deposit_confirmations() */
|
||||
GNUNET_PQ_make_prepare ("auditor_deposit_confirmation_select",
|
||||
"SELECT"
|
||||
@ -228,8 +222,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",master_sig" /* master_sig could be normalized... */
|
||||
" FROM deposit_confirmations"
|
||||
" WHERE master_pub=$1"
|
||||
" AND serial_id>$2",
|
||||
2),
|
||||
" AND serial_id>$2"),
|
||||
/* Used in #postgres_update_auditor_progress_reserve() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_update_reserve",
|
||||
"UPDATE auditor_progress_reserve SET "
|
||||
@ -242,8 +235,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_account_merges_serial_id=$7"
|
||||
",last_history_requests_serial_id=$8"
|
||||
",last_close_requests_serial_id=$9"
|
||||
" WHERE master_pub=$10",
|
||||
10),
|
||||
" WHERE master_pub=$10"),
|
||||
/* Used in #postgres_get_auditor_progress_reserve() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_select_reserve",
|
||||
"SELECT"
|
||||
@ -257,8 +249,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_history_requests_serial_id"
|
||||
",last_close_requests_serial_id"
|
||||
" FROM auditor_progress_reserve"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_auditor_progress_reserve() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_insert_reserve",
|
||||
"INSERT INTO auditor_progress_reserve "
|
||||
@ -272,48 +263,41 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_account_merges_serial_id"
|
||||
",last_history_requests_serial_id"
|
||||
",last_close_requests_serial_id"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10);",
|
||||
10),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10);"),
|
||||
/* Used in #postgres_update_auditor_progress_aggregation() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_update_aggregation",
|
||||
"UPDATE auditor_progress_aggregation SET "
|
||||
" last_wire_out_serial_id=$1"
|
||||
" WHERE master_pub=$2",
|
||||
2),
|
||||
" WHERE master_pub=$2"),
|
||||
/* Used in #postgres_get_auditor_progress_aggregation() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_select_aggregation",
|
||||
"SELECT"
|
||||
" last_wire_out_serial_id"
|
||||
" FROM auditor_progress_aggregation"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_auditor_progress_aggregation() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_insert_aggregation",
|
||||
"INSERT INTO auditor_progress_aggregation "
|
||||
"(master_pub"
|
||||
",last_wire_out_serial_id"
|
||||
") VALUES ($1,$2);",
|
||||
2),
|
||||
") VALUES ($1,$2);"),
|
||||
/* Used in #postgres_update_auditor_progress_deposit_confirmation() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_update_deposit_confirmation",
|
||||
"UPDATE auditor_progress_deposit_confirmation SET "
|
||||
" last_deposit_confirmation_serial_id=$1"
|
||||
" WHERE master_pub=$2",
|
||||
2),
|
||||
" WHERE master_pub=$2"),
|
||||
/* Used in #postgres_get_auditor_progress_deposit_confirmation() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_select_deposit_confirmation",
|
||||
"SELECT"
|
||||
" last_deposit_confirmation_serial_id"
|
||||
" FROM auditor_progress_deposit_confirmation"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_auditor_progress_deposit_confirmation() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_insert_deposit_confirmation",
|
||||
"INSERT INTO auditor_progress_deposit_confirmation "
|
||||
"(master_pub"
|
||||
",last_deposit_confirmation_serial_id"
|
||||
") VALUES ($1,$2);",
|
||||
2),
|
||||
") VALUES ($1,$2);"),
|
||||
/* Used in #postgres_update_auditor_progress_coin() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_update_coin",
|
||||
"UPDATE auditor_progress_coin SET "
|
||||
@ -325,8 +309,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_recoup_refresh_serial_id=$6"
|
||||
",last_purse_deposits_serial_id=$7"
|
||||
",last_purse_refunds_serial_id=$8"
|
||||
" WHERE master_pub=$9",
|
||||
9),
|
||||
" WHERE master_pub=$9"),
|
||||
/* Used in #postgres_get_auditor_progress_coin() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_select_coin",
|
||||
"SELECT"
|
||||
@ -339,8 +322,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_purse_deposits_serial_id"
|
||||
",last_purse_refunds_serial_id"
|
||||
" FROM auditor_progress_coin"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_auditor_progress() */
|
||||
GNUNET_PQ_make_prepare ("auditor_progress_insert_coin",
|
||||
"INSERT INTO auditor_progress_coin "
|
||||
@ -353,8 +335,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_recoup_refresh_serial_id"
|
||||
",last_purse_deposits_serial_id"
|
||||
",last_purse_refunds_serial_id"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9);",
|
||||
9),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9);"),
|
||||
/* Used in #postgres_insert_wire_auditor_account_progress() */
|
||||
GNUNET_PQ_make_prepare ("wire_auditor_account_progress_insert",
|
||||
"INSERT INTO wire_auditor_account_progress "
|
||||
@ -364,8 +345,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_wire_wire_out_serial_id"
|
||||
",wire_in_off"
|
||||
",wire_out_off"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6);",
|
||||
6),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6);"),
|
||||
/* Used in #postgres_update_wire_auditor_account_progress() */
|
||||
GNUNET_PQ_make_prepare ("wire_auditor_account_progress_update",
|
||||
"UPDATE wire_auditor_account_progress SET "
|
||||
@ -373,8 +353,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",last_wire_wire_out_serial_id=$2"
|
||||
",wire_in_off=$3"
|
||||
",wire_out_off=$4"
|
||||
" WHERE master_pub=$5 AND account_name=$6",
|
||||
6),
|
||||
" WHERE master_pub=$5 AND account_name=$6"),
|
||||
/* Used in #postgres_get_wire_auditor_account_progress() */
|
||||
GNUNET_PQ_make_prepare ("wire_auditor_account_progress_select",
|
||||
"SELECT"
|
||||
@ -383,31 +362,27 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",wire_in_off"
|
||||
",wire_out_off"
|
||||
" FROM wire_auditor_account_progress"
|
||||
" WHERE master_pub=$1 AND account_name=$2;",
|
||||
2),
|
||||
" WHERE master_pub=$1 AND account_name=$2;"),
|
||||
/* Used in #postgres_insert_wire_auditor_progress() */
|
||||
GNUNET_PQ_make_prepare ("wire_auditor_progress_insert",
|
||||
"INSERT INTO wire_auditor_progress "
|
||||
"(master_pub"
|
||||
",last_timestamp"
|
||||
",last_reserve_close_uuid"
|
||||
") VALUES ($1,$2,$3);",
|
||||
3),
|
||||
") VALUES ($1,$2,$3);"),
|
||||
/* Used in #postgres_update_wire_auditor_progress() */
|
||||
GNUNET_PQ_make_prepare ("wire_auditor_progress_update",
|
||||
"UPDATE wire_auditor_progress SET "
|
||||
" last_timestamp=$1"
|
||||
",last_reserve_close_uuid=$2"
|
||||
" WHERE master_pub=$3",
|
||||
3),
|
||||
" WHERE master_pub=$3"),
|
||||
/* Used in #postgres_get_wire_auditor_progress() */
|
||||
GNUNET_PQ_make_prepare ("wire_auditor_progress_select",
|
||||
"SELECT"
|
||||
" last_timestamp"
|
||||
",last_reserve_close_uuid"
|
||||
" FROM wire_auditor_progress"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_reserve_info() */
|
||||
GNUNET_PQ_make_prepare ("auditor_reserves_insert",
|
||||
"INSERT INTO auditor_reserves "
|
||||
@ -419,8 +394,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",withdraw_fee_balance_frac"
|
||||
",expiration_date"
|
||||
",origin_account"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8);",
|
||||
8),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8);"),
|
||||
/* Used in #postgres_update_reserve_info() */
|
||||
GNUNET_PQ_make_prepare ("auditor_reserves_update",
|
||||
"UPDATE auditor_reserves SET"
|
||||
@ -429,8 +403,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",withdraw_fee_balance_val=$3"
|
||||
",withdraw_fee_balance_frac=$4"
|
||||
",expiration_date=$5"
|
||||
" WHERE reserve_pub=$6 AND master_pub=$7;",
|
||||
7),
|
||||
" WHERE reserve_pub=$6 AND master_pub=$7;"),
|
||||
/* Used in #postgres_get_reserve_info() */
|
||||
GNUNET_PQ_make_prepare ("auditor_reserves_select",
|
||||
"SELECT"
|
||||
@ -442,14 +415,12 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",auditor_reserves_rowid"
|
||||
",origin_account"
|
||||
" FROM auditor_reserves"
|
||||
" WHERE reserve_pub=$1 AND master_pub=$2;",
|
||||
2),
|
||||
" WHERE reserve_pub=$1 AND master_pub=$2;"),
|
||||
/* Used in #postgres_del_reserve_info() */
|
||||
GNUNET_PQ_make_prepare ("auditor_reserves_delete",
|
||||
"DELETE"
|
||||
" FROM auditor_reserves"
|
||||
" WHERE reserve_pub=$1 AND master_pub=$2;",
|
||||
2),
|
||||
" WHERE reserve_pub=$1 AND master_pub=$2;"),
|
||||
/* Used in #postgres_insert_reserve_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_reserve_balance_insert",
|
||||
"INSERT INTO auditor_reserve_balance"
|
||||
@ -462,8 +433,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",purse_fee_balance_frac"
|
||||
",history_fee_balance_val"
|
||||
",history_fee_balance_frac"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)",
|
||||
9),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)"),
|
||||
/* Used in #postgres_update_reserve_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_reserve_balance_update",
|
||||
"UPDATE auditor_reserve_balance SET"
|
||||
@ -475,8 +445,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",purse_fee_balance_frac=$6"
|
||||
",history_fee_balance_val=$7"
|
||||
",history_fee_balance_frac=$8"
|
||||
" WHERE master_pub=$9;",
|
||||
9),
|
||||
" WHERE master_pub=$9;"),
|
||||
/* Used in #postgres_get_reserve_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_reserve_balance_select",
|
||||
"SELECT"
|
||||
@ -489,31 +458,27 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",history_fee_balance_val"
|
||||
",history_fee_balance_frac"
|
||||
" FROM auditor_reserve_balance"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_wire_fee_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_wire_fee_balance_insert",
|
||||
"INSERT INTO auditor_wire_fee_balance"
|
||||
"(master_pub"
|
||||
",wire_fee_balance_val"
|
||||
",wire_fee_balance_frac"
|
||||
") VALUES ($1,$2,$3)",
|
||||
3),
|
||||
") VALUES ($1,$2,$3)"),
|
||||
/* Used in #postgres_update_wire_fee_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_wire_fee_balance_update",
|
||||
"UPDATE auditor_wire_fee_balance SET"
|
||||
" wire_fee_balance_val=$1"
|
||||
",wire_fee_balance_frac=$2"
|
||||
" WHERE master_pub=$3;",
|
||||
3),
|
||||
" WHERE master_pub=$3;"),
|
||||
/* Used in #postgres_get_wire_fee_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_wire_fee_balance_select",
|
||||
"SELECT"
|
||||
" wire_fee_balance_val"
|
||||
",wire_fee_balance_frac"
|
||||
" FROM auditor_wire_fee_balance"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_denomination_balance() */
|
||||
GNUNET_PQ_make_prepare ("auditor_denomination_pending_insert",
|
||||
"INSERT INTO auditor_denomination_pending "
|
||||
@ -529,8 +494,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",recoup_loss_frac"
|
||||
") VALUES ("
|
||||
"$1,$2,$3,$4,$5,$6,$7,$8,$9,$10"
|
||||
");",
|
||||
10),
|
||||
");"),
|
||||
/* Used in #postgres_update_denomination_balance() */
|
||||
GNUNET_PQ_make_prepare ("auditor_denomination_pending_update",
|
||||
"UPDATE auditor_denomination_pending SET"
|
||||
@ -543,8 +507,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",denom_risk_frac=$7"
|
||||
",recoup_loss_val=$8"
|
||||
",recoup_loss_frac=$9"
|
||||
" WHERE denom_pub_hash=$10",
|
||||
10),
|
||||
" WHERE denom_pub_hash=$10"),
|
||||
/* Used in #postgres_get_denomination_balance() */
|
||||
GNUNET_PQ_make_prepare ("auditor_denomination_pending_select",
|
||||
"SELECT"
|
||||
@ -558,8 +521,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",recoup_loss_val"
|
||||
",recoup_loss_frac"
|
||||
" FROM auditor_denomination_pending"
|
||||
" WHERE denom_pub_hash=$1",
|
||||
1),
|
||||
" WHERE denom_pub_hash=$1"),
|
||||
/* Used in #postgres_insert_balance_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_balance_summary_insert",
|
||||
"INSERT INTO auditor_balance_summary "
|
||||
@ -579,8 +541,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",irregular_recoup_val"
|
||||
",irregular_recoup_frac"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,"
|
||||
" $11,$12,$13,$14,$15);",
|
||||
15),
|
||||
" $11,$12,$13,$14,$15);"),
|
||||
/* Used in #postgres_update_balance_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_balance_summary_update",
|
||||
"UPDATE auditor_balance_summary SET"
|
||||
@ -598,8 +559,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",loss_frac=$12"
|
||||
",irregular_recoup_val=$13"
|
||||
",irregular_recoup_frac=$14"
|
||||
" WHERE master_pub=$15;",
|
||||
15),
|
||||
" WHERE master_pub=$15;"),
|
||||
/* Used in #postgres_get_balance_summary() */
|
||||
GNUNET_PQ_make_prepare ("auditor_balance_summary_select",
|
||||
"SELECT"
|
||||
@ -618,8 +578,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",irregular_recoup_val"
|
||||
",irregular_recoup_frac"
|
||||
" FROM auditor_balance_summary"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_historic_denom_revenue() */
|
||||
GNUNET_PQ_make_prepare ("auditor_historic_denomination_revenue_insert",
|
||||
"INSERT INTO auditor_historic_denomination_revenue"
|
||||
@ -630,8 +589,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",revenue_balance_frac"
|
||||
",loss_balance_val"
|
||||
",loss_balance_frac"
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7);",
|
||||
7),
|
||||
") VALUES ($1,$2,$3,$4,$5,$6,$7);"),
|
||||
/* Used in #postgres_select_historic_denom_revenue() */
|
||||
GNUNET_PQ_make_prepare ("auditor_historic_denomination_revenue_select",
|
||||
"SELECT"
|
||||
@ -642,8 +600,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",loss_balance_val"
|
||||
",loss_balance_frac"
|
||||
" FROM auditor_historic_denomination_revenue"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_historic_reserve_revenue() */
|
||||
GNUNET_PQ_make_prepare ("auditor_historic_reserve_summary_insert",
|
||||
"INSERT INTO auditor_historic_reserve_summary"
|
||||
@ -652,8 +609,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",end_date"
|
||||
",reserve_profits_val"
|
||||
",reserve_profits_frac"
|
||||
") VALUES ($1,$2,$3,$4,$5);",
|
||||
5),
|
||||
") VALUES ($1,$2,$3,$4,$5);"),
|
||||
/* Used in #postgres_select_historic_reserve_revenue() */
|
||||
GNUNET_PQ_make_prepare ("auditor_historic_reserve_summary_select",
|
||||
"SELECT"
|
||||
@ -662,8 +618,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",reserve_profits_val"
|
||||
",reserve_profits_frac"
|
||||
" FROM auditor_historic_reserve_summary"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
/* Used in #postgres_insert_predicted_result() */
|
||||
GNUNET_PQ_make_prepare ("auditor_predicted_result_insert",
|
||||
"INSERT INTO auditor_predicted_result"
|
||||
@ -672,8 +627,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",balance_frac"
|
||||
",drained_val"
|
||||
",drained_frac"
|
||||
") VALUES ($1,$2,$3,$4,$5);",
|
||||
5),
|
||||
") VALUES ($1,$2,$3,$4,$5);"),
|
||||
/* Used in #postgres_update_predicted_result() */
|
||||
GNUNET_PQ_make_prepare ("auditor_predicted_result_update",
|
||||
"UPDATE auditor_predicted_result SET"
|
||||
@ -681,8 +635,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",balance_frac=$2"
|
||||
",drained_val=$3"
|
||||
",drained_frac=$4"
|
||||
" WHERE master_pub=$5;",
|
||||
5),
|
||||
" WHERE master_pub=$5;"),
|
||||
/* Used in #postgres_get_predicted_balance() */
|
||||
GNUNET_PQ_make_prepare ("auditor_predicted_result_select",
|
||||
"SELECT"
|
||||
@ -691,8 +644,7 @@ setup_connection (struct PostgresClosure *pg)
|
||||
",drained_val"
|
||||
",drained_frac"
|
||||
" FROM auditor_predicted_result"
|
||||
" WHERE master_pub=$1;",
|
||||
1),
|
||||
" WHERE master_pub=$1;"),
|
||||
GNUNET_PQ_PREPARED_STATEMENT_END
|
||||
};
|
||||
struct GNUNET_PQ_ExecuteStatement es[] = {
|
||||
|
@ -55,8 +55,12 @@
|
||||
#include "taler-exchange-httpd_recoup-refresh.h"
|
||||
#include "taler-exchange-httpd_refreshes_reveal.h"
|
||||
#include "taler-exchange-httpd_refund.h"
|
||||
#include "taler-exchange-httpd_reserves_attest.h"
|
||||
#include "taler-exchange-httpd_reserves_close.h"
|
||||
#include "taler-exchange-httpd_reserves_get.h"
|
||||
#include "taler-exchange-httpd_reserves_get_attest.h"
|
||||
#include "taler-exchange-httpd_reserves_history.h"
|
||||
#include "taler-exchange-httpd_reserves_open.h"
|
||||
#include "taler-exchange-httpd_reserves_purse.h"
|
||||
#include "taler-exchange-httpd_reserves_status.h"
|
||||
#include "taler-exchange-httpd_terms.h"
|
||||
@ -360,14 +364,14 @@ handle_post_reserves (struct TEH_RequestContext *rc,
|
||||
ReserveOpHandler handler;
|
||||
|
||||
} h[] = {
|
||||
{
|
||||
.op = "withdraw",
|
||||
.handler = &TEH_handler_withdraw
|
||||
},
|
||||
{
|
||||
.op = "batch-withdraw",
|
||||
.handler = &TEH_handler_batch_withdraw
|
||||
},
|
||||
{
|
||||
.op = "withdraw",
|
||||
.handler = &TEH_handler_withdraw
|
||||
},
|
||||
{
|
||||
.op = "status",
|
||||
.handler = &TEH_handler_reserves_status
|
||||
@ -380,6 +384,18 @@ handle_post_reserves (struct TEH_RequestContext *rc,
|
||||
.op = "purse",
|
||||
.handler = &TEH_handler_reserves_purse
|
||||
},
|
||||
{
|
||||
.op = "open",
|
||||
.handler = &TEH_handler_reserves_open
|
||||
},
|
||||
{
|
||||
.op = "attest",
|
||||
.handler = &TEH_handler_reserves_attest
|
||||
},
|
||||
{
|
||||
.op = "close",
|
||||
.handler = &TEH_handler_reserves_close
|
||||
},
|
||||
{
|
||||
.op = NULL,
|
||||
.handler = NULL
|
||||
@ -1038,6 +1054,27 @@ handle_post_auditors (struct TEH_RequestContext *rc,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle a GET "/reserves/$RID/$XXX" request.
|
||||
*
|
||||
* @param rc request context
|
||||
* @param args array of additional options (length: 1, just the reserve_pub)
|
||||
* @return MHD result code
|
||||
*/
|
||||
static MHD_RESULT
|
||||
handler_reserves_get3 (struct TEH_RequestContext *rc,
|
||||
const char *const args[3])
|
||||
{
|
||||
if (0 == strcmp (args[2],
|
||||
"attest"))
|
||||
return TEH_handler_reserves_get_attest (rc,
|
||||
args);
|
||||
GNUNET_break_op (0);
|
||||
return r404 (rc->connection,
|
||||
"/reserves/$RID/*");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle incoming HTTP request.
|
||||
*
|
||||
@ -1151,6 +1188,12 @@ handle_mhd_request (void *cls,
|
||||
.handler.get = &TEH_handler_reserves_get,
|
||||
.nargs = 1
|
||||
},
|
||||
{
|
||||
.url = "reserves",
|
||||
.method = MHD_HTTP_METHOD_GET,
|
||||
.handler.get = &handler_reserves_get3,
|
||||
.nargs = 3
|
||||
},
|
||||
{
|
||||
.url = "reserves",
|
||||
.method = MHD_HTTP_METHOD_POST,
|
||||
|
@ -184,12 +184,18 @@ reserve_open_transaction (void *cls,
|
||||
struct TEH_PurseDepositedCoin *coin = &rsc->payments[i];
|
||||
bool insufficient_funds = true;
|
||||
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Make coin %u known\n",
|
||||
i);
|
||||
qs = TEH_make_coin_known (&coin->cpi,
|
||||
connection,
|
||||
&coin->known_coin_id,
|
||||
mhd_ret);
|
||||
if (qs < 0)
|
||||
return qs;
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Insert open deposit %u known\n",
|
||||
i);
|
||||
qs = TEH_plugin->insert_reserve_open_deposit (
|
||||
TEH_plugin->cls,
|
||||
&coin->cpi,
|
||||
@ -215,6 +221,8 @@ reserve_open_transaction (void *cls,
|
||||
}
|
||||
if (insufficient_funds)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Handle insufficient funds\n");
|
||||
*mhd_ret
|
||||
= TEH_RESPONSE_reply_coin_insufficient_funds (
|
||||
connection,
|
||||
@ -225,6 +233,8 @@ reserve_open_transaction (void *cls,
|
||||
}
|
||||
}
|
||||
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Do reserve open\n");
|
||||
qs = TEH_plugin->do_reserve_open (TEH_plugin->cls,
|
||||
/* inputs */
|
||||
rsc->reserve_pub,
|
||||
@ -263,6 +273,7 @@ reserve_open_transaction (void *cls,
|
||||
}
|
||||
if (rsc->no_funds)
|
||||
{
|
||||
TEH_plugin->rollback (TEH_plugin->cls);
|
||||
*mhd_ret
|
||||
= TEH_RESPONSE_reply_reserve_insufficient_balance (
|
||||
connection,
|
||||
|
@ -56,12 +56,12 @@ TEH_PG_do_reserve_open (
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_bool ("out_no_funds",
|
||||
no_funds),
|
||||
TALER_PQ_RESULT_SPEC_AMOUNT ("out_open_cost",
|
||||
open_cost),
|
||||
GNUNET_PQ_result_spec_timestamp ("out_final_expiration",
|
||||
final_expiration),
|
||||
GNUNET_PQ_result_spec_bool ("out_no_funds",
|
||||
no_funds),
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
@ -73,7 +73,7 @@ TEH_PG_do_reserve_open (
|
||||
",out_final_expiration"
|
||||
",out_no_funds"
|
||||
" FROM exchange_do_reserve_open"
|
||||
" ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11);");
|
||||
" ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);");
|
||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"do_reserve_open",
|
||||
params,
|
||||
|
@ -113,7 +113,7 @@ struct PostgresClosure
|
||||
if (prep_cnt < pg->prep_gen) \
|
||||
{ \
|
||||
struct GNUNET_PQ_PreparedStatement ps[] = { \
|
||||
GNUNET_PQ_make_prepare (name, sql, 0), \
|
||||
GNUNET_PQ_make_prepare (name, sql), \
|
||||
GNUNET_PQ_PREPARED_STATEMENT_END \
|
||||
}; \
|
||||
\
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -252,6 +252,9 @@ handle_reserves_open_finished (void *cls,
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
GNUNET_break (0);
|
||||
json_dumpf (j,
|
||||
stderr,
|
||||
JSON_INDENT (2));
|
||||
rs.hr.ec = TALER_JSON_get_error_code (j);
|
||||
rs.hr.hint = TALER_JSON_get_error_hint (j);
|
||||
break;
|
||||
@ -452,7 +455,7 @@ TALER_EXCHANGE_reserves_open (
|
||||
cpa),
|
||||
TALER_JSON_pack_amount ("reserve_payment",
|
||||
reserve_contribution),
|
||||
GNUNET_JSON_pack_uint64 ("min_purses",
|
||||
GNUNET_JSON_pack_uint64 ("purse_limit",
|
||||
min_purses),
|
||||
GNUNET_JSON_pack_data_auto ("reserve_sig",
|
||||
&roh->reserve_sig));
|
||||
|
@ -354,6 +354,70 @@ run (void *cls,
|
||||
TALER_TESTING_cmd_end ()
|
||||
};
|
||||
struct TALER_TESTING_Command reserves[] = {
|
||||
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-100",
|
||||
"EUR:1.04"),
|
||||
TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-100",
|
||||
"EUR:1.04",
|
||||
bc.user42_payto,
|
||||
bc.exchange_payto,
|
||||
"create-reserve-100"),
|
||||
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-101",
|
||||
"EUR:1.04"),
|
||||
TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-101",
|
||||
"EUR:1.04",
|
||||
bc.user42_payto,
|
||||
bc.exchange_payto,
|
||||
"create-reserve-101"),
|
||||
CMD_EXEC_WIREWATCH ("wirewatch-100"),
|
||||
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-100",
|
||||
"create-reserve-100",
|
||||
"EUR:1",
|
||||
0, /* age restriction off */
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_reserve_open ("reserve-open-101-fail",
|
||||
"create-reserve-101",
|
||||
"EUR:0",
|
||||
GNUNET_TIME_UNIT_YEARS,
|
||||
5, /* min purses */
|
||||
MHD_HTTP_PAYMENT_REQUIRED, // FIXME: or CONFLICT?
|
||||
NULL,
|
||||
NULL),
|
||||
TALER_TESTING_cmd_reserve_open ("reserve-open-101-ok",
|
||||
"create-reserve-101",
|
||||
"EUR:0.01",
|
||||
GNUNET_TIME_UNIT_MONTHS,
|
||||
1, /* min purses */
|
||||
MHD_HTTP_OK,
|
||||
NULL,
|
||||
NULL),
|
||||
TALER_TESTING_cmd_status ("status-101-open-paid",
|
||||
"create-reserve-101",
|
||||
"EUR:1.03",
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_reserve_open ("reserve-open-101-ok",
|
||||
"create-reserve-101",
|
||||
"EUR:0",
|
||||
GNUNET_TIME_UNIT_MONTHS,
|
||||
2, /* min purses */
|
||||
MHD_HTTP_OK,
|
||||
"withdraw-coin-100",
|
||||
"EUR:0.02",
|
||||
NULL,
|
||||
NULL),
|
||||
/* FIXME: use purse quota here */
|
||||
TALER_TESTING_cmd_reserve_get_attestable ("reserve-101-attestable",
|
||||
"create-reserve-101",
|
||||
MHD_HTTP_OK,
|
||||
NULL),
|
||||
TALER_TESTING_cmd_reserve_get_attestable ("reserve-101-attest",
|
||||
"create-reserve-101",
|
||||
MHD_HTTP_CONFLICT,
|
||||
"nx-attribute-name",
|
||||
NULL),
|
||||
TALER_TESTING_cmd_reserve_close ("reserve-101-close",
|
||||
"create-reserve-101",
|
||||
NULL, /* to origin */
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_end ()
|
||||
};
|
||||
|
||||
@ -387,9 +451,11 @@ run (void *cls,
|
||||
config_file),
|
||||
TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
|
||||
1),
|
||||
#if 0
|
||||
TALER_TESTING_cmd_batch ("reserves",
|
||||
reserves),
|
||||
TALER_TESTING_cmd_end (), // FIXME
|
||||
#endif
|
||||
TALER_TESTING_cmd_batch ("withdraw",
|
||||
withdraw),
|
||||
TALER_TESTING_cmd_batch ("push",
|
||||
|
Loading…
Reference in New Issue
Block a user