commit 509ca4121a568179c460ed293c6e63f5740aec55
parent 2d3e7e86dba75c881dc15a9c76f221e312dd84df
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 29 Aug 2024 07:04:36 +0200
no coin_pub needed in refreshes_hanging table
Diffstat:
6 files changed, 55 insertions(+), 58 deletions(-)
diff --git a/src/auditor/taler-auditor-httpd_refreshes-hanging-get.c b/src/auditor/taler-auditor-httpd_refreshes-hanging-get.c
@@ -44,16 +44,14 @@ process_refreshes_hanging (
json_t *obj;
obj = GNUNET_JSON_PACK (
-
- TALER_JSON_pack_amount ("amount", &dc->amount),
- GNUNET_JSON_pack_data_auto ("coin_pub", &dc->coin_pub)
-
+ TALER_JSON_pack_amount ("amount",
+ &dc->amount),
+ GNUNET_JSON_pack_uint64 ("problem_row",
+ dc->problem_row_id)
);
GNUNET_break (0 ==
json_array_append_new (list,
obj));
-
-
return GNUNET_OK;
}
@@ -69,6 +67,9 @@ TAH_REFRESHES_HANGING_handler_get (
{
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
+ int64_t limit = -20;
+ uint64_t offset;
+ bool return_suppressed = false;
(void) rh;
(void) connection_cls;
@@ -83,34 +84,31 @@ TAH_REFRESHES_HANGING_handler_get (
TALER_EC_GENERIC_DB_SETUP_FAILED,
NULL);
}
- ja = json_array ();
- GNUNET_break (NULL != ja);
-
- int64_t limit = -20;
- uint64_t offset;
-
TALER_MHD_parse_request_snumber (connection,
"limit",
&limit);
-
if (limit < 0)
offset = INT64_MAX;
else
offset = 0;
-
TALER_MHD_parse_request_number (connection,
"offset",
&offset);
-
- bool return_suppressed = false;
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- return_suppressed = true;
+ const char *ret_s
+ = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s,
+ "true")) )
+ {
+ return_suppressed = true;
+ }
}
-
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
qs = TAH_plugin->get_refreshes_hanging (
TAH_plugin->cls,
limit,
@@ -118,7 +116,6 @@ TAH_REFRESHES_HANGING_handler_get (
return_suppressed,
&process_refreshes_hanging,
ja);
-
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
@@ -1446,8 +1446,7 @@ refresh_session_cb (void *cls,
still report it. */
struct TALER_AUDITORDB_RefreshesHanging rh = {
.problem_row_id = rowid,
- .amount = *amount_with_fee,
- .coin_pub = coin_pub->eddsa_pub
+ .amount = *amount_with_fee
};
qs = TALER_ARL_adb->insert_refreshes_hanging (
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
@@ -460,6 +460,18 @@ function call_endpoint() {
fi
}
+
+function check_balance() {
+ call_endpoint "balances" "$1"
+ BAL=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/${1}.json")
+ if [ "$BAL" != "$2" ]
+ then
+ exit_fail "$3"
+ fi
+ echo "PASS"
+}
+
+
function test_0() {
echo "===========0: normal run with aggregator==========="
@@ -491,6 +503,11 @@ function test_0() {
call_endpoint "balances"
echo -n "Testing loss balances... "
+ check_balance \
+ "aggregation_total_bad_sig_loss" \
+ "TESTKUDOS:0" \
+ "Wrong total bad sig loss from aggregation, got unexpected loss of '$LOSS'"
+
call_endpoint "balances" "aggregation_total_bad_sig_loss"
LOSS=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/aggregation_total_bad_sig_loss.json")
if [ "$LOSS" != "TESTKUDOS:0" ]
@@ -924,7 +941,7 @@ function test_6() {
fi
OP=$(jq -r .bad_sig_losses[0].operation < "${MY_TMP_DIR}/bad-sig-losses.json")
- if [ "$OP" != "melt" ]
+ if [ "$OP" != "melt" ] && [ "$OP" != "deposit" ]
then
exit_fail "Wrong operation, got $OP"
fi
diff --git a/src/auditordb/pg_get_refreshes_hanging.c b/src/auditordb/pg_get_refreshes_hanging.c
@@ -13,17 +13,14 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include "taler_error_codes.h"
#include "taler_dbevents.h"
#include "taler_pq_lib.h"
#include "pg_helper.h"
-
-
#include "pg_get_refreshes_hanging.h"
+
/**
* Closure for #refreshes_hanging_cb().
*/
@@ -72,15 +69,12 @@ refreshes_hanging_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
uint64_t serial_id;
-
struct TALER_AUDITORDB_RefreshesHanging dc;
-
struct GNUNET_PQ_ResultSpec rs[] = {
-
- GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount),
- GNUNET_PQ_result_spec_auto_from_type ("coin_pub", &dc.coin_pub),
-
+ GNUNET_PQ_result_spec_uint64 ("row_id",
+ &serial_id),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
+ &dc.amount),
GNUNET_PQ_result_spec_end
};
enum GNUNET_GenericReturnValue rval;
@@ -94,9 +88,7 @@ refreshes_hanging_cb (void *cls,
dcc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return;
}
-
dcc->qs = i + 1;
-
rval = dcc->cb (dcc->cb_cls,
serial_id,
&dc);
@@ -112,14 +104,12 @@ TAH_PG_get_refreshes_hanging (
void *cls,
int64_t limit,
uint64_t offset,
- bool return_suppressed, // maybe not needed
+ bool return_suppressed,
TALER_AUDITORDB_RefreshesHangingCallback cb,
void *cb_cls)
{
-
- uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit);
-
struct PostgresClosure *pg = cls;
+ uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit);
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&offset),
GNUNET_PQ_query_param_bool (return_suppressed),
@@ -138,7 +128,6 @@ TAH_PG_get_refreshes_hanging (
"SELECT"
" row_id"
",amount"
- ",coin_pub"
" FROM auditor_refreshes_hanging"
" WHERE (row_id < $1)"
" AND ($2 OR suppressed is false)"
@@ -150,23 +139,22 @@ TAH_PG_get_refreshes_hanging (
"SELECT"
" row_id"
",amount"
- ",coin_pub"
" FROM auditor_refreshes_hanging"
" WHERE (row_id > $1)"
" AND ($2 OR suppressed is false)"
" ORDER BY row_id ASC"
" LIMIT $3"
);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- (limit > 0) ?
- "auditor_refreshes_hanging_get_asc"
- : "auditor_refreshes_hanging_get_desc",
- params,
- &refreshes_hanging_cb,
- &dcc);
-
+ qs = GNUNET_PQ_eval_prepared_multi_select (
+ pg->conn,
+ (limit > 0)
+ ? "auditor_refreshes_hanging_get_asc"
+ : "auditor_refreshes_hanging_get_desc",
+ params,
+ &refreshes_hanging_cb,
+ &dcc);
if (qs > 0)
return dcc.qs;
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
return qs;
-}
-\ No newline at end of file
+}
diff --git a/src/auditordb/pg_insert_refreshes_hanging.c b/src/auditordb/pg_insert_refreshes_hanging.c
@@ -29,7 +29,6 @@ TAH_PG_insert_refreshes_hanging (
TALER_PQ_query_param_amount (pg->conn,
&dc->amount),
GNUNET_PQ_query_param_uint64 (&dc->problem_row_id),
- GNUNET_PQ_query_param_auto_from_type (&dc->coin_pub),
GNUNET_PQ_query_param_end
};
@@ -38,7 +37,6 @@ TAH_PG_insert_refreshes_hanging (
"INSERT INTO auditor_refreshes_hanging "
"(amount"
",problem_row_id"
- ",coin_pub"
") VALUES ($1,$2);"
);
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h
@@ -320,7 +320,6 @@ struct TALER_AUDITORDB_RefreshesHanging
uint64_t row_id;
uint64_t problem_row_id;
struct TALER_Amount amount;
- struct GNUNET_CRYPTO_EddsaPublicKey coin_pub;
};
/**