diff options
| author | Christian Grothoff <christian@grothoff.org> | 2022-03-05 16:16:38 +0100 |
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2022-03-05 16:16:38 +0100 |
| commit | 57470e4c0891e2a98fd33fec0ed9b49da4997c2a (patch) | |
| tree | 644dd9e727301b762ee2756edf62418a36eaff37 /src/exchangedb | |
| parent | 5fa977cc05daca469044711ffb6a497287094c70 (diff) | |
-more work on global_fees
Diffstat (limited to 'src/exchangedb')
| -rw-r--r-- | src/exchangedb/irbt_callbacks.c | 30 | ||||
| -rw-r--r-- | src/exchangedb/lrbt_callbacks.c | 48 | ||||
| -rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 53 |
3 files changed, 113 insertions, 18 deletions
diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c index ae486343..e417c106 100644 --- a/src/exchangedb/irbt_callbacks.c +++ b/src/exchangedb/irbt_callbacks.c @@ -659,12 +659,30 @@ irbt_cb_table_global_fee (struct PostgresClosure *pg, const struct TALER_EXCHANGEDB_TableData *td) { struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&td->serial), - GNUNET_PQ_query_param_timestamp (&td->details.global_fee.start_date), - GNUNET_PQ_query_param_timestamp (&td->details.global_fee.end_date), - TALER_PQ_query_param_amount (&td->details.global_fee.fees.history), - TALER_PQ_query_param_amount (&td->details.global_fee.fees.kyc), - GNUNET_PQ_query_param_auto_from_type (&td->details.wire_fee.master_sig), + GNUNET_PQ_query_param_uint64 ( + &td->serial), + GNUNET_PQ_query_param_timestamp ( + &td->details.global_fee.start_date), + GNUNET_PQ_query_param_timestamp ( + &td->details.global_fee.end_date), + TALER_PQ_query_param_amount ( + &td->details.global_fee.fees.history), + TALER_PQ_query_param_amount ( + &td->details.global_fee.fees.kyc), + TALER_PQ_query_param_amount ( + &td->details.global_fee.fees.account), + TALER_PQ_query_param_amount ( + &td->details.global_fee.fees.purse), + GNUNET_PQ_query_param_relative_time ( + &td->details.global_fee.purse_timeout), + GNUNET_PQ_query_param_relative_time ( + &td->details.global_fee.kyc_timeout), + GNUNET_PQ_query_param_relative_time ( + &td->details.global_fee.history_expiration), + GNUNET_PQ_query_param_uint32 ( + &td->details.global_fee.purse_account_limit), + GNUNET_PQ_query_param_auto_from_type ( + &td->details.global_fee.master_sig), GNUNET_PQ_query_param_end }; diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c index 233ecbc1..9e9f3778 100644 --- a/src/exchangedb/lrbt_callbacks.c +++ b/src/exchangedb/lrbt_callbacks.c @@ -1220,18 +1220,42 @@ lrbt_cb_table_global_fee (void *cls, for (unsigned int i = 0; i<num_results; i++) { struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint64 ("serial", - &td.serial), - GNUNET_PQ_result_spec_timestamp ("start_date", - &td.details.global_fee.start_date), - GNUNET_PQ_result_spec_timestamp ("end_date", - &td.details.global_fee.end_date), - TALER_PQ_RESULT_SPEC_AMOUNT ("history_fee", - &td.details.global_fee.fees.history), - TALER_PQ_RESULT_SPEC_AMOUNT ("kyc_fee", - &td.details.global_fee.fees.kyc), - GNUNET_PQ_result_spec_auto_from_type ("master_sig", - &td.details.global_fee.master_sig), + GNUNET_PQ_result_spec_uint64 ( + "serial", + &td.serial), + GNUNET_PQ_result_spec_timestamp ( + "start_date", + &td.details.global_fee.start_date), + GNUNET_PQ_result_spec_timestamp ( + "end_date", + &td.details.global_fee.end_date), + TALER_PQ_RESULT_SPEC_AMOUNT ( + "history_fee", + &td.details.global_fee.fees.history), + TALER_PQ_RESULT_SPEC_AMOUNT ( + "kyc_fee", + &td.details.global_fee.fees.kyc), + TALER_PQ_RESULT_SPEC_AMOUNT ( + "account_fee", + &td.details.global_fee.fees.account), + TALER_PQ_RESULT_SPEC_AMOUNT ( + "purse_fee", + &td.details.global_fee.fees.purse), + GNUNET_PQ_result_spec_relative_time ( + "purse_timeout", + &td.details.global_fee.purse_timeout), + GNUNET_PQ_result_spec_relative_time ( + "kyc_timeout", + &td.details.global_fee.kyc_timeout), + GNUNET_PQ_result_spec_relative_time ( + "history_expiration", + &td.details.global_fee.history_expiration), + GNUNET_PQ_result_spec_uint32 ( + "purse_account_limit", + &td.details.global_fee.purse_account_limit), + GNUNET_PQ_result_spec_auto_from_type ( + "master_sig", + &td.details.global_fee.master_sig), GNUNET_PQ_result_spec_end }; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index cdc383bf..fe06634f 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -2116,6 +2116,14 @@ prepare_statements (struct PostgresClosure *pg) " LIMIT 1;", 0), GNUNET_PQ_make_prepare ( + "select_serial_by_table_global_fee", + "SELECT" + " global_fee_serial AS serial" + " FROM global_fee" + " ORDER BY global_fee_serial DESC" + " LIMIT 1;", + 0), + GNUNET_PQ_make_prepare ( "select_serial_by_table_recoup", "SELECT" " recoup_uuid AS serial" @@ -2437,6 +2445,29 @@ prepare_statements (struct PostgresClosure *pg) " ORDER BY wire_fee_serial ASC;", 1), GNUNET_PQ_make_prepare ( + "select_above_serial_by_table_global_fee", + "SELECT" + " global_fee_serial AS serial" + ",start_date" + ",end_date" + ",history_fee_val" + ",history_fee_frac" + ",kyc_fee_val" + ",kyc_fee_frac" + ",account_fee_val" + ",account_fee_frac" + ",purse_fee_val" + ",purse_fee_frac" + ",purse_timeout" + ",kyc_timeout" + ",history_expiration" + ",purse_account_limit" + ",master_sig" + " FROM global_fee" + " WHERE global_fee_serial > $1" + " ORDER BY global_fee_serial ASC;", + 1), + GNUNET_PQ_make_prepare ( "select_above_serial_by_table_recoup", "SELECT" " recoup_uuid AS serial" @@ -2728,6 +2759,28 @@ prepare_statements (struct PostgresClosure *pg) "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);", 11), GNUNET_PQ_make_prepare ( + "insert_into_table_global_fee", + "INSERT INTO global_fee" + "(global_fee_serial" + ",start_date" + ",end_date" + ",history_fee_val" + ",history_fee_frac" + ",kyc_fee_val" + ",kyc_fee_frac" + ",account_fee_val" + ",account_fee_frac" + ",purse_fee_val" + ",purse_fee_frac" + ",purse_timeout" + ",kyc_timeout" + ",history_expiration" + ",purse_account_limit" + ",master_sig" + ") VALUES " + "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16);", + 16), + GNUNET_PQ_make_prepare ( "insert_into_table_recoup", "INSERT INTO recoup" "(recoup_uuid" |
