exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit ca98699ba49f692df84f294aef312a7837bfe246
parent 2d3b6763b1ecb75faaa6622765c19a082113c3f3
Author: Florian Dold <dold@taler.net>
Date:   Mon, 31 Aug 2026 14:55:42 +0200

auditor: update monitoring API to version 2

Diffstat:
Msrc/auditor/generate-auditor-basedb.conf | 2+-
Msrc/auditor/generate-auditor-basedb.sh | 4++--
Msrc/auditor/generate-kyc-basedb.sh | 4++--
Msrc/auditor/generate-revoke-basedb.sh | 4++--
Msrc/auditor/meson.build | 1-
Msrc/auditor/revoke-basedb.conf | 2+-
Msrc/auditor/taler-auditor-httpd.c | 159++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Msrc/auditor/taler-auditor-httpd.h | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/auditor/taler-auditor-httpd_delete-generic.c | 3++-
Msrc/auditor/taler-auditor-httpd_get-monitoring-aml-holds.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-bad-sig-losses.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-balances.c | 7++-----
Msrc/auditor/taler-auditor-httpd_get-monitoring-closure-lags.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-coin-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.c | 14+++++---------
Dsrc/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.c | 129-------------------------------------------------------------------------------
Dsrc/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.h | 58----------------------------------------------------------
Msrc/auditor/taler-auditor-httpd_get-monitoring-denominations-without-sigs.c | 13+++++--------
Msrc/auditor/taler-auditor-httpd_get-monitoring-deposit-confirmations.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-early-aggregation.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-emergency-by-count.c | 13+++++--------
Msrc/auditor/taler-auditor-httpd_get-monitoring-emergency.c | 13+++++--------
Msrc/auditor/taler-auditor-httpd_get-monitoring-fee-time-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-historic-denomination-revenue.c | 14+++++---------
Msrc/auditor/taler-auditor-httpd_get-monitoring-historic-reserve-summary.c | 12++++--------
Msrc/auditor/taler-auditor-httpd_get-monitoring-kycauth-in-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-pending-deposits.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-progress.c | 7++-----
Msrc/auditor/taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-purses.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-reserves.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-row-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-wire-format-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_get-monitoring-wire-out-inconsistency.c | 11++++-------
Msrc/auditor/taler-auditor-httpd_mhd.c | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/auditor/taler-auditor-httpd_patch-generic-suppressed.c | 3++-
Msrc/auditor/taler-auditor-httpd_put-deposit-confirmation.c | 9+++++----
Msrc/auditor/test-auditor.sh | 144+++++++++++++++++++++++++++++++++++++------------------------------------------
Msrc/auditor/test-kyc.sh | 120++++++++++++++++++++++++++++++++++++-------------------------------------------
Msrc/auditor/test-revocation.sh | 64++++++++++++++++++++++++++++------------------------------------
Msrc/auditordb/drop.sql | 2+-
Msrc/auditordb/helper.c | 2++
Msrc/include/auditordb_lib.h | 10++++++++++
Msrc/testing/taler-unified-setup.sh | 7+++----
51 files changed, 502 insertions(+), 670 deletions(-)

diff --git a/src/auditor/generate-auditor-basedb.conf b/src/auditor/generate-auditor-basedb.conf @@ -48,7 +48,7 @@ IDLE_RESERVE_EXPIRATION_TIME = 4 weeks LEGAL_RESERVE_EXPIRATION_TIME = 4 weeks [exchange-account-1] -PAYTO_URI = payto://iban/DE989651?receiver-name=Exchange+Company +PAYTO_URI = payto://iban/DE89370400440532013000?receiver-name=Exchange+Company ENABLE_DEBIT = YES ENABLE_CREDIT = YES diff --git a/src/auditor/generate-auditor-basedb.sh b/src/auditor/generate-auditor-basedb.sh @@ -87,7 +87,7 @@ curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external echo " DONE" echo -n "Setting up merchant account ..." -FORTYTHREE="payto://iban/DE474361?receiver-name=Merchant43" +FORTYTHREE="payto://iban/DE12500105170648489890?receiver-name=Merchant43" STATUS=$(curl -H "Content-Type: application/json" -X POST \ "${MERCHANT_URL}private/accounts" \ -d '{"payto_uri":"'"$FORTYTHREE"'"}' \ @@ -105,7 +105,7 @@ libeufin-bank create-account \ --name="Merchant43" \ --username="Merchant43" \ --password="password" \ - --payto_uri="payto://iban/DE474361?receiver-name=Merchant43" + --payto_uri="payto://iban/DE12500105170648489890?receiver-name=Merchant43" echo " DONE" diff --git a/src/auditor/generate-kyc-basedb.sh b/src/auditor/generate-kyc-basedb.sh @@ -76,8 +76,8 @@ echo " FOUND" # The bank account of the merchant instance that passes KYC, and the one # of the instance that stays blocked. -CLEARED_PAYTO="payto://iban/DE474361?receiver-name=Merchant43" -BLOCKED_PAYTO="payto://iban/DE61109451?receiver-name=Blocked44" +CLEARED_PAYTO="payto://iban/DE12500105170648489890?receiver-name=Merchant43" +BLOCKED_PAYTO="payto://iban/DE12500105170540732493?receiver-name=Blocked44" # reset database echo -n "Reset 'auditor-basedb' database at ${PGHOST:-} ..." diff --git a/src/auditor/generate-revoke-basedb.sh b/src/auditor/generate-revoke-basedb.sh @@ -47,7 +47,7 @@ curl -H "Content-Type: application/json" -X POST -d '{"auth": {"method": "extern echo " DONE" echo -n "Setting up merchant account ..." -FORTYTHREE="payto://iban/DE474361?receiver-name=Merchant43" +FORTYTHREE="payto://iban/DE12500105170648489890?receiver-name=Merchant43" STATUS=$(curl -H "Content-Type: application/json" -X POST \ "${MERCHANT_URL}private/accounts" \ -d '{"payto_uri":"'"$FORTYTHREE"'"}' \ @@ -64,7 +64,7 @@ libeufin-bank create-account \ --name="Merchant43" \ --username="Merchant43" \ --password="password" \ - --payto_uri="payto://iban/DE474361?receiver-name=Merchant43" + --payto_uri="payto://iban/DE12500105170648489890?receiver-name=Merchant43" echo " DONE" diff --git a/src/auditor/meson.build b/src/auditor/meson.build @@ -251,7 +251,6 @@ taler_auditor_httpd_SOURCES = [ 'taler-auditor-httpd_get-monitoring-reserves.c', 'taler-auditor-httpd_get-monitoring-purses.c', 'taler-auditor-httpd_get-monitoring-historic-denomination-revenue.c', - 'taler-auditor-httpd_get-monitoring-denomination-pending.c', 'taler-auditor-httpd_get-monitoring-historic-reserve-summary.c', 'taler-auditor-httpd_get-monitoring-wire-format-inconsistency.c', 'taler-auditor-httpd_get-monitoring-wire-out-inconsistency.c', diff --git a/src/auditor/revoke-basedb.conf b/src/auditor/revoke-basedb.conf @@ -4,7 +4,7 @@ TINY_AMOUNT = TESTKUDOS:0.01 BASE_URL = http://localhost:8083/ [exchange-account-1] -PAYTO_URI = payto://iban/SANDBOXX/DE717324?receiver-name=Exchange+Company +PAYTO_URI = payto://iban/DE89370400440532013000?receiver-name=Exchange+Company enable_debit = yes enable_credit = yes diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c @@ -62,7 +62,6 @@ #include "taler-auditor-httpd_get-monitoring-purses.h" #include "taler-auditor-httpd_get-monitoring-historic-denomination-revenue.h" #include "taler-auditor-httpd_get-monitoring-historic-reserve-summary.h" -#include "taler-auditor-httpd_get-monitoring-denomination-pending.h" #include "taler-auditor-httpd_get-monitoring-wire-format-inconsistency.h" #include "taler-auditor-httpd_get-monitoring-wire-out-inconsistency.h" #include \ @@ -86,7 +85,7 @@ * release version, and the format is NOT the same that semantic * versioning uses either. */ -#define AUDITOR_PROTOCOL_VERSION "1:0:1" +#define AUDITOR_PROTOCOL_VERSION "2:0:0" /** * Salt we use when doing the KDF for access. @@ -235,6 +234,8 @@ handle_config (struct TAH_RequestHandler *rh, "taler-auditor"), GNUNET_JSON_pack_string ("version", AUDITOR_PROTOCOL_VERSION), + GNUNET_JSON_pack_string ("build_version", + PACKAGE_VERSION), GNUNET_JSON_pack_string ("implementation", "urn:net:taler:specs:taler-auditor:c-reference"), GNUNET_JSON_pack_string ("currency", @@ -345,11 +346,11 @@ handle_mhd_request (void *cls, .method = MHD_HTTP_METHOD_PUT, .mime_type = "application/json", .handler = &TAH_put_deposit_confirmation, - .response_code = MHD_HTTP_OK}, + .response_code = MHD_HTTP_NO_CONTENT}, { .url = "/spa", .method = MHD_HTTP_METHOD_GET, .handler = &TAH_spa_handler}, - { .url = "/monitoring/deposit-confirmation", + { .url = "/monitoring/deposit-confirmations", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -357,6 +358,13 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_deposit_confirmations, .response_code = MHD_HTTP_OK, .requires_auth = true }, + { .url = "/monitoring/deposit-confirmations", + .method = MHD_HTTP_METHOD_PATCH, + .mime_type = "application/json", + .handler = &TAH_patch_generic_suppressed, + .response_code = MHD_HTTP_NO_CONTENT, + .requires_auth = true, + .table = TALER_AUDITORDB_DEPOSIT_CONFIRMATION }, { .url = "/monitoring/pending-deposits", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", @@ -365,7 +373,21 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_pending_deposits, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/early-aggregation", + { .url = "/monitoring/pending-deposits", + .method = MHD_HTTP_METHOD_DELETE, + .mime_type = "application/json", + .handler = &TAH_delete_generic, + .response_code = MHD_HTTP_NO_CONTENT, + .requires_auth = true, + .table = TALER_AUDITORDB_PENDING_DEPOSITS }, + { .url = "/monitoring/pending-deposits", + .method = MHD_HTTP_METHOD_PATCH, + .mime_type = "application/json", + .handler = &TAH_patch_generic_suppressed, + .response_code = MHD_HTTP_NO_CONTENT, + .requires_auth = true, + .table = TALER_AUDITORDB_PENDING_DEPOSITS }, + { .url = "/monitoring/early-aggregations", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -373,7 +395,21 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_early_aggregation, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/deposit-confirmation", + { .url = "/monitoring/early-aggregations", + .method = MHD_HTTP_METHOD_DELETE, + .mime_type = "application/json", + .handler = &TAH_delete_generic, + .response_code = MHD_HTTP_NO_CONTENT, + .requires_auth = true, + .table = TALER_AUDITORDB_EARLY_AGGREGATIONS }, + { .url = "/monitoring/early-aggregations", + .method = MHD_HTTP_METHOD_PATCH, + .mime_type = "application/json", + .handler = &TAH_patch_generic_suppressed, + .response_code = MHD_HTTP_NO_CONTENT, + .requires_auth = true, + .table = TALER_AUDITORDB_EARLY_AGGREGATIONS }, + { .url = "/monitoring/deposit-confirmations", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -382,7 +418,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_DEPOSIT_CONFIRMATION }, - { .url = "/monitoring/amount-arithmetic-inconsistency", + { .url = "/monitoring/amount-arithmetic-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -390,7 +426,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_amount_arithmetic_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/amount-arithmetic-inconsistency", + { .url = "/monitoring/amount-arithmetic-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -399,7 +435,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_AMOUNT_ARITHMETIC_INCONSISTENCY }, - { .url = "/monitoring/amount-arithmetic-inconsistency", + { .url = "/monitoring/amount-arithmetic-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -408,7 +444,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_AMOUNT_ARITHMETIC_INCONSISTENCY }, - { .url = "/monitoring/coin-inconsistency", + { .url = "/monitoring/coin-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -416,7 +452,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_coin_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/coin-inconsistency", + { .url = "/monitoring/coin-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -425,7 +461,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_COIN_INCONSISTENCY }, - { .url = "/monitoring/coin-inconsistency", + { .url = "/monitoring/coin-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -434,7 +470,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_COIN_INCONSISTENCY }, - { .url = "/monitoring/row-inconsistency", + { .url = "/monitoring/row-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -442,7 +478,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_row_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/row-inconsistency", + { .url = "/monitoring/row-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -451,7 +487,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_ROW_INCONSISTENCY}, - { .url = "/monitoring/row-inconsistency", + { .url = "/monitoring/row-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -538,7 +574,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_CLOSURE_LAGS }, - { .url = "/monitoring/emergency", + { .url = "/monitoring/emergencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -546,7 +582,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_emergency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/emergency", + { .url = "/monitoring/emergencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -555,7 +591,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_EMERGENCY }, - { .url = "/monitoring/emergency", + { .url = "/monitoring/emergencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -564,7 +600,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_EMERGENCY }, - { .url = "/monitoring/denomination-key-validity-withdraw-inconsistency", + { .url = "/monitoring/denomination-key-validity-withdraw-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -573,7 +609,7 @@ handle_mhd_request (void *cls, &TAH_get_monitoring_denomination_key_validity_withdraw_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/denomination-key-validity-withdraw-inconsistency", + { .url = "/monitoring/denomination-key-validity-withdraw-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -583,7 +619,7 @@ handle_mhd_request (void *cls, .requires_auth = true, .table = TALER_AUDITORDB_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY} , - { .url = "/monitoring/denomination-key-validity-withdraw-inconsistency", + { .url = "/monitoring/denomination-key-validity-withdraw-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -593,7 +629,7 @@ handle_mhd_request (void *cls, .requires_auth = true, .table = TALER_AUDITORDB_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY} , - { .url = "/monitoring/reserve-balance-insufficient-inconsistency", + { .url = "/monitoring/reserve-balance-insufficient-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -601,7 +637,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_reserve_balance_insufficient_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/reserve-balance-insufficient-inconsistency", + { .url = "/monitoring/reserve-balance-insufficient-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -610,7 +646,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY }, - { .url = "/monitoring/reserve-balance-insufficient-inconsistency", + { .url = "/monitoring/reserve-balance-insufficient-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -645,7 +681,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_PURSE_NOT_CLOSED_INCONSISTENCY }, - { .url = "/monitoring/emergency-by-count", + { .url = "/monitoring/emergencies-by-count", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -653,7 +689,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_emergency_by_count, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/emergency-by-count", + { .url = "/monitoring/emergencies-by-count", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -662,7 +698,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_EMERGENCY_BY_COUNT }, - { .url = "/monitoring/emergency-by-count", + { .url = "/monitoring/emergencies-by-count", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -671,7 +707,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_EMERGENCY_BY_COUNT }, - { .url = "/monitoring/reserve-in-inconsistency", + { .url = "/monitoring/reserve-in-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -679,7 +715,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_reserve_in_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/reserve-in-inconsistency", + { .url = "/monitoring/reserve-in-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -688,7 +724,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_RESERVE_IN_INCONSISTENCY }, - { .url = "/monitoring/reserve-in-inconsistency", + { .url = "/monitoring/reserve-in-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -697,7 +733,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_RESERVE_IN_INCONSISTENCY }, - { .url = "/monitoring/kycauth-in-inconsistency", + { .url = "/monitoring/kycauth-in-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -705,7 +741,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_kycauth_in_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/kycauth-in-inconsistency", + { .url = "/monitoring/kycauth-in-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -714,7 +750,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_KYCAUTH_IN_INCONSISTENCY }, - { .url = "/monitoring/kycauth-in-inconsistency", + { .url = "/monitoring/kycauth-in-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -723,7 +759,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_KYCAUTH_IN_INCONSISTENCY }, - { .url = "/monitoring/reserve-not-closed-inconsistency", + { .url = "/monitoring/reserve-not-closed-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -731,7 +767,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_reserve_not_closed_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/reserve-not-closed-inconsistency", + { .url = "/monitoring/reserve-not-closed-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -740,7 +776,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_RESERVE_NOT_CLOSED_INCONSISTENCY }, - { .url = "/monitoring/reserve-not-closed-inconsistency", + { .url = "/monitoring/reserve-not-closed-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -775,7 +811,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_DENOMINATIONS_WITHOUT_SIG }, - { .url = "/monitoring/misattribution-in-inconsistency", + { .url = "/monitoring/misattribution-in-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -783,7 +819,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_misattribution_in_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/misattribution-in-inconsistency", + { .url = "/monitoring/misattribution-in-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -792,7 +828,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_MISATTRIBUTION_IN_INCONSISTENCY }, - { .url = "/monitoring/misattribution-in-inconsistency", + { .url = "/monitoring/misattribution-in-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -817,7 +853,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_purses, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/historic-denomination-revenue", + { .url = "/monitoring/historic-denomination-revenues", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -825,24 +861,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_historic_denomination_revenue, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/denomination-pending", - .method = MHD_HTTP_METHOD_GET, - .mime_type = "application/json", - .data = NULL, - .data_size = 0, - .handler = &TAH_get_monitoring_denomination_pending, - .response_code = MHD_HTTP_OK, - .requires_auth = true }, - { .url = "/monitoring/denomination-pending", - .method = MHD_HTTP_METHOD_DELETE, - .mime_type = "application/json", - .data = NULL, - .data_size = 0, - .handler = &TAH_delete_generic, - .response_code = MHD_HTTP_OK, - .requires_auth = true, - .table = TALER_AUDITORDB_DENOMINATION_PENDING }, - { .url = "/monitoring/historic-reserve-summary", + { .url = "/monitoring/historic-reserve-summaries", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -850,7 +869,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_historic_reserve_summary, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/wire-format-inconsistency", + { .url = "/monitoring/wire-format-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -858,7 +877,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_wire_format_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/wire-format-inconsistency", + { .url = "/monitoring/wire-format-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -867,7 +886,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_WIRE_FORMAT_INCONSISTENCY }, - { .url = "/monitoring/wire-format-inconsistency", + { .url = "/monitoring/wire-format-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -876,7 +895,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_WIRE_FORMAT_INCONSISTENCY }, - { .url = "/monitoring/wire-out-inconsistency", + { .url = "/monitoring/wire-out-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -884,7 +903,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_wire_out_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/wire-out-inconsistency", + { .url = "/monitoring/wire-out-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -893,7 +912,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_WIRE_OUT_INCONSISTENCY }, - { .url = "/monitoring/wire-out-inconsistency", + { .url = "/monitoring/wire-out-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -902,7 +921,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_WIRE_OUT_INCONSISTENCY }, - { .url = "/monitoring/reserve-balance-summary-wrong-inconsistency", + { .url = "/monitoring/reserve-balance-summary-wrong-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -911,7 +930,7 @@ handle_mhd_request (void *cls, , .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/reserve-balance-summary-wrong-inconsistency", + { .url = "/monitoring/reserve-balance-summary-wrong-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -920,7 +939,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY }, - { .url = "/monitoring/reserve-balance-summary-wrong-inconsistency", + { .url = "/monitoring/reserve-balance-summary-wrong-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, @@ -955,7 +974,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_ROW_MINOR_INCONSISTENCY }, - { .url = "/monitoring/fee-time-inconsistency", + { .url = "/monitoring/fee-time-inconsistencies", .method = MHD_HTTP_METHOD_GET, .mime_type = "application/json", .data = NULL, @@ -963,7 +982,7 @@ handle_mhd_request (void *cls, .handler = &TAH_get_monitoring_fee_time_inconsistency, .response_code = MHD_HTTP_OK, .requires_auth = true }, - { .url = "/monitoring/fee-time-inconsistency", + { .url = "/monitoring/fee-time-inconsistencies", .method = MHD_HTTP_METHOD_DELETE, .mime_type = "application/json", .data = NULL, @@ -972,7 +991,7 @@ handle_mhd_request (void *cls, .response_code = MHD_HTTP_OK, .requires_auth = true, .table = TALER_AUDITORDB_FEE_TIME_INCONSISTENCY }, - { .url = "/monitoring/fee-time-inconsistency", + { .url = "/monitoring/fee-time-inconsistencies", .method = MHD_HTTP_METHOD_PATCH, .mime_type = "application/json", .data = NULL, diff --git a/src/auditor/taler-auditor-httpd.h b/src/auditor/taler-auditor-httpd.h @@ -23,12 +23,49 @@ #ifndef TALER_AUDITOR_HTTPD_H #define TALER_AUDITOR_HTTPD_H +#include <jansson.h> #include <microhttpd.h> +#include "taler/taler_error_codes.h" +#include "taler/taler_mhd_lib.h" #include "auditordb_lib.h" #include "exchangedb_lib.h" /** + * Largest integer exactly representable by JSON consumers using IEEE-754. + */ +#define TAH_SAFE_UINT64_MAX UINT64_C (9007199254740991) + + +/** + * Parse an optional unsigned request argument as a SafeUint64. + */ +#define TAH_PARSE_SAFE_REQUEST_NUMBER(connection,name,off) do { \ + TALER_MHD_parse_request_number (connection, name, off); \ + if (*(off) > TAH_SAFE_UINT64_MAX) \ + return TALER_MHD_reply_with_error ( \ + connection, \ + MHD_HTTP_BAD_REQUEST, \ + TALER_EC_GENERIC_PARAMETER_MALFORMED, \ + name); \ + } while (0) + + +/** + * Parse the signed, non-zero limit used by row-ID pagination. + */ +#define TAH_PARSE_REQUEST_LIMIT(connection,name,limit) do { \ + TALER_MHD_parse_request_snumber (connection, name, limit); \ + if (0 == *(limit)) \ + return TALER_MHD_reply_with_error ( \ + connection, \ + MHD_HTTP_BAD_REQUEST, \ + TALER_EC_GENERIC_PARAMETER_MALFORMED, \ + name); \ + } while (0) + + +/** * Our auditor database context. */ extern struct TALER_AUDITORDB_PostgresContext *TAH_apg; @@ -56,6 +93,19 @@ extern char *TAH_spa_dir; */ extern char *TAH_currency; + +/** + * Return a monitoring response after checking that all JSON integers satisfy + * the API's SafeUint64 invariant. Takes ownership of @a records. + * + * @param connection connection to respond on + * @param records monitoring records to return + * @return MHD result code + */ +enum MHD_Result +TAH_reply_json_records (struct MHD_Connection *connection, + json_t *records); + /** * @brief Struct describing an URL and the handler for it. */ diff --git a/src/auditor/taler-auditor-httpd_delete-generic.c b/src/auditor/taler-auditor-httpd_delete-generic.c @@ -55,7 +55,8 @@ TAH_delete_generic ( (1 != sscanf (args[2], "%llu%c", &row_id, - &dummy))) + &dummy)) || + (row_id > TAH_SAFE_UINT64_MAX)) { GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-aml-holds.c b/src/auditor/taler-auditor-httpd_get-monitoring-aml-holds.c @@ -119,14 +119,14 @@ TAH_get_monitoring_aml_holds ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -159,9 +159,6 @@ TAH_get_monitoring_aml_holds ( TALER_EC_GENERIC_DB_FETCH_FAILED, "iterate_auditor_aml_holds"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("aml_holds", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.c @@ -92,14 +92,14 @@ TAH_get_monitoring_amount_arithmetic_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -137,9 +137,6 @@ TAH_get_monitoring_amount_arithmetic_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "amount-arithmetic-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("amount_arithmetic_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-bad-sig-losses.c b/src/auditor/taler-auditor-httpd_get-monitoring-bad-sig-losses.c @@ -93,14 +93,14 @@ TAH_get_monitoring_bad_sig_losses ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -140,9 +140,6 @@ TAH_get_monitoring_bad_sig_losses ( TALER_EC_GENERIC_DB_FETCH_FAILED, "bad-sig-losses"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("bad_sig_losses", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-balances.c b/src/auditor/taler-auditor-httpd_get-monitoring-balances.c @@ -105,9 +105,6 @@ TAH_get_monitoring_balances ( TALER_EC_GENERIC_DB_FETCH_FAILED, "balances"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("balances", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-closure-lags.c b/src/auditor/taler-auditor-httpd_get-monitoring-closure-lags.c @@ -90,14 +90,14 @@ TAH_get_monitoring_closure_lags ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -130,9 +130,6 @@ TAH_get_monitoring_closure_lags ( TALER_EC_GENERIC_DB_FETCH_FAILED, "get_auditor_closure_lags"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("closure_lags", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-coin-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-coin-inconsistency.c @@ -83,14 +83,14 @@ TAH_get_monitoring_coin_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -122,9 +122,6 @@ TAH_get_monitoring_coin_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "coin-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("coin_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.c @@ -53,7 +53,7 @@ process_denomination_key_validity_withdraw_inconsistency ( dc->execution_date), GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub), - GNUNET_JSON_pack_data_auto ("denompub_h", + GNUNET_JSON_pack_data_auto ("h_denom_pub", &dc->denompub_h), GNUNET_JSON_pack_bool ("suppressed", dc->suppressed) @@ -95,14 +95,14 @@ TAH_get_monitoring_denomination_key_validity_withdraw_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -136,10 +136,6 @@ TAH_get_monitoring_denomination_key_validity_withdraw_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "denomination-key-validity-withdraw-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ( - "denomination_key_validity_withdraw_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.c b/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.c @@ -1,129 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - 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 <gnunet/gnunet_util_lib.h> -#include <gnunet/gnunet_json_lib.h> -#include <jansson.h> -#include <microhttpd.h> -#include <pthread.h> -#include "taler/taler_json_lib.h" -#include "taler/taler_mhd_lib.h" -#include "taler-auditor-httpd.h" -#include "taler-auditor-httpd_get-monitoring-denomination-pending.h" -#define TALER_AUDITORDB_DENOMINATION_PENDING_RESULT_CLOSURE json_t -#include "auditor-database/iterate_denomination_pending.h" -#include "auditor-database/preflight.h" - -/** - * Add denomination-pending to the list. - * - * @param[in,out] list a `json_t *` array to extend - * @param serial_id location of the @a dc in the database - * @param dc struct of inconsistencies - * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating - */ -static enum GNUNET_GenericReturnValue -process_denomination_pending ( - json_t *list, - uint64_t serial_id, - const struct TALER_AUDITORDB_DenominationPending *dc) -{ - json_t *obj; - - obj = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("denom_pub_hash", - &dc->denom_pub_hash), - TALER_JSON_pack_amount ("denom_balance", - &dc->denom_balance), - TALER_JSON_pack_amount ("denom_loss", - &dc->denom_loss), - GNUNET_JSON_pack_int64 ("num_issued", - dc->num_issued), - TALER_JSON_pack_amount ("denom_risk", - &dc->denom_risk), - TALER_JSON_pack_amount ("recoup_loss", - &dc->recoup_loss) - ); - GNUNET_break (0 == - json_array_append_new (list, - obj)); - return GNUNET_OK; -} - - -enum MHD_Result -TAH_get_monitoring_denomination_pending ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - json_t *ja; - enum GNUNET_DB_QueryStatus qs; - int64_t limit = -20; - uint64_t offset; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - if (GNUNET_SYSERR == - TALER_AUDITORDB_preflight (TAH_apg)) - { - GNUNET_break (0); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_SETUP_FAILED, - NULL); - } - 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); - ja = json_array (); - GNUNET_break (NULL != ja); - qs = TALER_AUDITORDB_iterate_denomination_pending ( - TAH_apg, - limit, - offset, - &process_denomination_pending, - ja); - - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - json_decref (ja); - TALER_LOG_WARNING ( - "Failed to handle GET /denomination-pending"); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "get_denomination_pending"); - } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("denomination_pending", - ja)); -} diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.h b/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.h @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - 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/> - */ - - -#ifndef TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATION_PENDING_H -#define TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATION_PENDING_H - -#include <gnunet/gnunet_util_lib.h> -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_get_monitoring_denomination_pending_init (void); - -/** - * Shut down subsystem. - */ -void -TEAH_get_monitoring_denomination_pending_done (void); - -/** - * Handle a "/denomination-pending" request. - * - * @param rh context of the handler - * @param connection the MHD connection to handle - * @param[in,out] connection_cls the connection's closure (can be updated) - * @param upload_data upload data - * @param[in,out] upload_data_size number of bytes (left) in @a upload_data - * @param args NULL-terminated array of remaining parts of the URI broken up at '/' - * @return MHD result code - */ -enum MHD_Result -TAH_get_monitoring_denomination_pending ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denominations-without-sigs.c b/src/auditor/taler-auditor-httpd_get-monitoring-denominations-without-sigs.c @@ -44,7 +44,7 @@ process_denominations_without_sigs ( obj = GNUNET_JSON_PACK ( GNUNET_JSON_pack_int64 ("row_id", dc->row_id), - GNUNET_JSON_pack_data_auto ("denompub_h", + GNUNET_JSON_pack_data_auto ("h_denom_pub", &dc->denompub_h), TALER_JSON_pack_amount ("value", &dc->value), @@ -90,14 +90,14 @@ TAH_get_monitoring_denominations_without_sigs ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -131,9 +131,6 @@ TAH_get_monitoring_denominations_without_sigs ( TALER_EC_GENERIC_DB_FETCH_FAILED, "denominations-without-sigs"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("denominations_without_sigs", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-deposit-confirmations.c b/src/auditor/taler-auditor-httpd_get-monitoring-deposit-confirmations.c @@ -133,14 +133,14 @@ TAH_get_monitoring_deposit_confirmations ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -174,11 +174,8 @@ TAH_get_monitoring_deposit_confirmations ( TALER_EC_GENERIC_DB_FETCH_FAILED, "deposit-confirmation"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("deposit_confirmation", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-early-aggregation.c b/src/auditor/taler-auditor-httpd_get-monitoring-early-aggregation.c @@ -84,14 +84,14 @@ TAH_get_monitoring_early_aggregation ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -125,9 +125,6 @@ TAH_get_monitoring_early_aggregation ( TALER_EC_GENERIC_DB_FETCH_FAILED, "select_early_aggregations"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("early_aggregations", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-emergency-by-count.c b/src/auditor/taler-auditor-httpd_get-monitoring-emergency-by-count.c @@ -43,7 +43,7 @@ process_emergency_by_count ( obj = GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("row_id", dc->row_id), - GNUNET_JSON_pack_data_auto ("denompub_h", + GNUNET_JSON_pack_data_auto ("h_denom_pub", &dc->denompub_h), GNUNET_JSON_pack_int64 ("num_issued", dc->num_issued), @@ -95,14 +95,14 @@ TAH_get_monitoring_emergency_by_count ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -136,9 +136,6 @@ TAH_get_monitoring_emergency_by_count ( TALER_EC_GENERIC_DB_FETCH_FAILED, "emergency-by-count"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("emergency_by_count", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-emergency.c b/src/auditor/taler-auditor-httpd_get-monitoring-emergency.c @@ -44,7 +44,7 @@ process_emergency ( obj = GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("row_id", dc->row_id), - GNUNET_JSON_pack_data_auto ("denompub_h", + GNUNET_JSON_pack_data_auto ("h_denom_pub", &dc->denompub_h), TALER_JSON_pack_amount ("denom_risk", &dc->denom_risk), @@ -94,14 +94,14 @@ TAH_get_monitoring_emergency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -135,9 +135,6 @@ TAH_get_monitoring_emergency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "emergency error"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("emergency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-fee-time-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-fee-time-inconsistency.c @@ -90,14 +90,14 @@ TAH_get_monitoring_fee_time_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -131,9 +131,6 @@ TAH_get_monitoring_fee_time_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "fee-time-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("fee_time_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-historic-denomination-revenue.c b/src/auditor/taler-auditor-httpd_get-monitoring-historic-denomination-revenue.c @@ -54,7 +54,7 @@ process_historic_denomination_revenue ( obj = GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("row_id", serial_id), - GNUNET_JSON_pack_data_auto ("denom_pub_hash", + GNUNET_JSON_pack_data_auto ("h_denom_pub", denom_pub_hash), TALER_JSON_pack_time_abs_human ("revenue_timestamp", revenue_timestamp.abs_time), @@ -100,14 +100,14 @@ TAH_get_monitoring_historic_denomination_revenue ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); ja = json_array (); @@ -130,10 +130,6 @@ TAH_get_monitoring_historic_denomination_revenue ( TALER_EC_GENERIC_DB_FETCH_FAILED, "select_historic_denom_revenue"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ( - "historic-denomination-revenue", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-historic-reserve-summary.c b/src/auditor/taler-auditor-httpd_get-monitoring-historic-reserve-summary.c @@ -94,14 +94,14 @@ TAH_get_monitoring_historic_reserve_summary ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); ja = json_array (); @@ -125,10 +125,6 @@ TAH_get_monitoring_historic_reserve_summary ( TALER_EC_GENERIC_DB_FETCH_FAILED, "select_historic_reserve_revenue"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ( - "historic-reserve-summary", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-kycauth-in-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-kycauth-in-inconsistency.c @@ -101,14 +101,14 @@ TAH_get_monitoring_kycauth_in_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -141,11 +141,8 @@ TAH_get_monitoring_kycauth_in_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "kycauth-in-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("kycauth_in_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.c @@ -88,14 +88,14 @@ TAH_get_monitoring_misattribution_in_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -129,9 +129,6 @@ TAH_get_monitoring_misattribution_in_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "misattribution-in-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("misattribution_in_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-pending-deposits.c b/src/auditor/taler-auditor-httpd_get-monitoring-pending-deposits.c @@ -94,14 +94,14 @@ TAH_get_monitoring_pending_deposits ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -136,9 +136,6 @@ TAH_get_monitoring_pending_deposits ( TALER_EC_GENERIC_DB_FETCH_FAILED, "select_pending_deposits"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("pending_deposits", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-progress.c b/src/auditor/taler-auditor-httpd_get-monitoring-progress.c @@ -100,9 +100,6 @@ TAH_get_monitoring_progress ( TALER_EC_GENERIC_DB_FETCH_FAILED, "progress"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("progress", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.c b/src/auditor/taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.c @@ -87,14 +87,14 @@ TAH_get_monitoring_purse_not_closed_inconsistencies ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); @@ -133,9 +133,6 @@ TAH_get_monitoring_purse_not_closed_inconsistencies ( TALER_EC_GENERIC_DB_FETCH_FAILED, "purse-not-closed-inconsistencies"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("purse_not_closed_inconsistencies", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-purses.c b/src/auditor/taler-auditor-httpd_get-monitoring-purses.c @@ -91,14 +91,14 @@ TAH_get_monitoring_purses ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); ja = json_array (); @@ -120,9 +120,6 @@ TAH_get_monitoring_purses ( TALER_EC_GENERIC_DB_FETCH_FAILED, "purses"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("purses", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.c @@ -92,14 +92,14 @@ TAH_get_monitoring_reserve_balance_insufficient_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); @@ -133,9 +133,6 @@ TAH_get_monitoring_reserve_balance_insufficient_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "reserve-balance-insufficient-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("reserve_balance_insufficient_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.c @@ -87,14 +87,14 @@ TAH_get_monitoring_reserve_balance_summary_wrong_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -129,9 +129,6 @@ TAH_get_monitoring_reserve_balance_summary_wrong_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "reserve-balance-summary-wrong-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("reserve_balance_summary_wrong_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.c @@ -98,14 +98,14 @@ TAH_get_monitoring_reserve_in_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -138,9 +138,6 @@ TAH_get_monitoring_reserve_in_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "reserve-in-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("reserve_in_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.c @@ -91,14 +91,14 @@ TAH_get_monitoring_reserve_not_closed_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -134,9 +134,6 @@ TAH_get_monitoring_reserve_not_closed_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "reserve-not-closed-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("reserve_not_closed_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserves.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserves.c @@ -102,7 +102,7 @@ TAH_get_monitoring_reserves ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); @@ -110,7 +110,7 @@ TAH_get_monitoring_reserves ( offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); ja = json_array (); @@ -132,9 +132,6 @@ TAH_get_monitoring_reserves ( TALER_EC_GENERIC_DB_FETCH_FAILED, "reserves"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("reserves", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-row-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-row-inconsistency.c @@ -88,14 +88,14 @@ TAH_get_monitoring_row_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -128,9 +128,6 @@ TAH_get_monitoring_row_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "row-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("row_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.c b/src/auditor/taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.c @@ -88,14 +88,14 @@ TAH_get_monitoring_row_minor_inconsistencies ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -133,9 +133,6 @@ TAH_get_monitoring_row_minor_inconsistencies ( TALER_EC_GENERIC_DB_FETCH_FAILED, "row-minor-inconsistencies"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("row_minor_inconsistencies", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-wire-format-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-wire-format-inconsistency.c @@ -90,14 +90,14 @@ TAH_get_monitoring_wire_format_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); { @@ -131,9 +131,6 @@ TAH_get_monitoring_wire_format_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "wire-format-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("wire_format_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-wire-out-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-wire-out-inconsistency.c @@ -92,14 +92,14 @@ TAH_get_monitoring_wire_out_inconsistency ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - TALER_MHD_parse_request_snumber (connection, + TAH_PARSE_REQUEST_LIMIT (connection, "limit", &limit); if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, + TAH_PARSE_SAFE_REQUEST_NUMBER (connection, "offset", &offset); @@ -134,9 +134,6 @@ TAH_get_monitoring_wire_out_inconsistency ( TALER_EC_GENERIC_DB_FETCH_FAILED, "wire-out-inconsistency"); } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("wire_out_inconsistency", - ja)); + return TAH_reply_json_records (connection, + ja); } diff --git a/src/auditor/taler-auditor-httpd_mhd.c b/src/auditor/taler-auditor-httpd_mhd.c @@ -32,6 +32,66 @@ #include "taler-auditor-httpd_mhd.h" +/** + * Check recursively that integers in @a value are valid SafeUint64 values. + * + * @param value JSON value to inspect + * @return true if all integers are safe + */ +static bool +json_integers_are_safe (const json_t *value) +{ + if (json_is_integer (value)) + { + json_int_t number = json_integer_value (value); + + return (number >= 0) && + ((uint64_t) number <= TAH_SAFE_UINT64_MAX); + } + if (json_is_array (value)) + { + size_t index; + json_t *child; + + json_array_foreach ((json_t *) value, index, child) + if (! json_integers_are_safe (child)) + return false; + } + if (json_is_object (value)) + { + const char *key; + json_t *child; + + json_object_foreach ((json_t *) value, key, child) + if (! json_integers_are_safe (child)) + return false; + } + return true; +} + + +enum MHD_Result +TAH_reply_json_records (struct MHD_Connection *connection, + json_t *records) +{ + if (! json_integers_are_safe (records)) + { + GNUNET_break (0); + json_decref (records); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, + "monitoring response contains an integer outside SafeUint64"); + } + return TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_OK, + GNUNET_JSON_pack_array_steal ("records", + records)); +} + + enum MHD_Result TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, diff --git a/src/auditor/taler-auditor-httpd_patch-generic-suppressed.c b/src/auditor/taler-auditor-httpd_patch-generic-suppressed.c @@ -56,7 +56,8 @@ TAH_patch_generic_suppressed ( (1 != sscanf (args[2], "%llu%c", &row_id, - &dummy)) ) + &dummy)) || + (row_id > TAH_SAFE_UINT64_MAX) ) { GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, diff --git a/src/auditor/taler-auditor-httpd_put-deposit-confirmation.c b/src/auditor/taler-auditor-httpd_put-deposit-confirmation.c @@ -265,10 +265,11 @@ verify_and_execute_deposit_confirmation ( TALER_EC_GENERIC_DB_STORE_FAILED, "deposit confirmation"); } - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_string ("status", - "DEPOSIT_CONFIRMATION_OK")); + return TALER_MHD_reply_static (connection, + MHD_HTTP_NO_CONTENT, + NULL, + NULL, + 0); } diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh @@ -376,7 +376,7 @@ function run_audit () { -L DEBUG \ -c "${CONF}" \ drain TESTKUDOS:0.1 \ - exchange-account-1 payto://iban/DE474361?receiver-name=Merchant43 \ + exchange-account-1 payto://iban/DE12500105170648489890?receiver-name=Merchant43 \ upload \ 2> "${MY_TMP_DIR}/taler-exchange-offline-drain.log" \ || exit_fail "offline draining failed" @@ -490,7 +490,7 @@ function call_endpoint() { function check_balance() { call_endpoint "balances" "$1" - BAL=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/${1}.json") + BAL=$(jq -r .records[0].balance_value < "${MY_TMP_DIR}/${1}.json") if [ "$BAL" != "$2" ] then exit_fail "$3 (got $BAL, wanted $2)" @@ -501,7 +501,7 @@ function check_balance() { function check_not_balance() { call_endpoint "balances" "$1" - BAL=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/${1}.json") + BAL=$(jq -r .records[0].balance_value < "${MY_TMP_DIR}/${1}.json") if [ "$BAL" = "$2" ] then exit_fail "$3 (got $BAL, wanted NOT $2)" @@ -512,9 +512,7 @@ function check_not_balance() { function check_report() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - VAL=$(jq -r .\"${NAME}\"[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") + VAL=$(jq -r .records[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") if [ "$VAL" != "$3" ] then exit_fail "$1::$2 (got $VAL, wanted $3)" @@ -529,9 +527,7 @@ function check_report() { # flagged once per operation that used it). function check_report_any() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - jq -e --arg want "$3" "any(.\"${NAME}\"[]; .\"$2\" == \$want)" \ + jq -e --arg want "$3" "any(.records[]; .\"$2\" == \$want)" \ < "${MY_TMP_DIR}/${1}.json" \ > /dev/null \ || exit_fail "$1::$2 (no entry with value $3)" @@ -540,9 +536,7 @@ function check_report_any() { function check_no_report() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - jq -e .\"${NAME}\"[0] \ + jq -e .records[0] \ < "${MY_TMP_DIR}/${1}.json" \ > /dev/null \ && exit_fail "Wanted empty report for $1, but got incidents" @@ -551,9 +545,7 @@ function check_no_report() { function check_report_neg() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - VAL=$(jq -r .\"${NAME}\"[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") + VAL=$(jq -r .records[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") if [ "$VAL" == "$3" ] then exit_fail "$1::$2 (got $VAL, wanted $3)" @@ -563,7 +555,6 @@ function check_report_neg() { function check_row() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') if [ -n "${3+x}" ] then RID="$2" @@ -572,8 +563,7 @@ function check_row() { RID="row_id" WANT="$2" fi - # shellcheck disable=SC2086 - ROW=$(jq -r .\"${NAME}\"[0].\"${RID}\" < "${MY_TMP_DIR}/${1}.json") + ROW=$(jq -r .records[0].\"${RID}\" < "${MY_TMP_DIR}/${1}.json") if [ "$ROW" != "$WANT" ] then exit_fail "Row ${1} wrong (got ${ROW}, wanted ${WANT})" @@ -592,13 +582,13 @@ function test_0() { # if an emergency was detected, that is a bug and we should fail echo -n "Test for emergencies... " - check_no_report "emergency" + check_no_report "emergencies" echo -n "Test for emergencies by count... " - check_no_report "emergency-by-count" + check_no_report "emergencies-by-count" echo -n "Test for wire inconsistencies... " - check_no_report "denomination-key-validity-withdraw-inconsistency" + check_no_report "denomination-key-validity-withdraw-inconsistencies" echo -n "Test for deposit confirmation problems... " - check_no_report "deposit-confirmation" + check_no_report "deposit-confirmations" # Just to test the endpoint and for logging ... call_endpoint "balances" @@ -710,7 +700,7 @@ function test_0() { "Wrong arithmetic delta minus from reserves" echo -n "Checking for unexpected wire out differences " - check_no_report "wire-out-inconsistency" + check_no_report "wire-out-inconsistencies" # cannot easily undo aggregator, hence full reload full_reload @@ -732,11 +722,11 @@ function test_1() { call_endpoint "balances" echo -n "Test for emergencies... " - check_no_report "emergency" + check_no_report "emergencies" echo -n "Test for emergencies by count... " - check_no_report "emergency-by-count" + check_no_report "emergencies-by-count" echo -n "Test for wire inconsistencies... " - check_no_report "denomination-key-validity-withdraw-inconsistency" + check_no_report "denomination-key-validity-withdraw-inconsistencies" # TODO: check operation balances are correct (once we have all transaction types and wallet is deterministic) # TODO: check revenue summaries are correct (once we have all transaction types and wallet is deterministic) @@ -782,15 +772,15 @@ function test_2() { echo -n "Testing inconsistency detection ... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "row_id" 1 echo -n "Testing inconsistency detection amount wired ... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_wired" "TESTKUDOS:10" echo -n "Testing inconsistency detection amount expected ... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_exchange_expected" "TESTKUDOS:5" call_endpoint "balances" @@ -826,10 +816,10 @@ function test_3() { echo "Checking reserve balance summary inconsistency detection ..." check_report \ - "reserve-balance-summary-wrong-inconsistency" \ + "reserve-balance-summary-wrong-inconsistencies" \ "auditor_amount" "TESTKUDOS:5.01" check_report \ - "reserve-balance-summary-wrong-inconsistency" \ + "reserve-balance-summary-wrong-inconsistencies" \ "exchange_amount" "TESTKUDOS:0.01" call_endpoint "balances" @@ -840,15 +830,15 @@ function test_3() { echo -n "Testing inconsistency detection ... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "row_id" 1 echo -n "Testing inconsistency detection amount wired ... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_wired" "TESTKUDOS:10" echo -n "Testing inconsistency detection amount expected ... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_exchange_expected" "TESTKUDOS:15" echo -n "Checking wire credit balance minus ... " @@ -1068,15 +1058,15 @@ function test_8() { echo -n "Checking inconsistency diagnostic ..." check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "diagnostic" "wire subject does not match" echo -n "Checking expected balance report ..." check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_exchange_expected" "TESTKUDOS:10" echo -n "Checking actual incoming balance report ..." check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_wired" "TESTKUDOS:0" echo -n "Checking balance update (bad plus)..." check_balance \ @@ -1108,7 +1098,7 @@ function test_9() { OLD_ACC=$(echo "SELECT debtor_payto FROM libeufin_bank.bank_account_transactions WHERE bank_transaction_id='$OLD_ID';" | psql "${DB}" -Aqt) echo -n "Modifying $OLD_ID ..." - echo "UPDATE libeufin_bank.bank_account_transactions SET debtor_payto='payto://iban/DE144373' WHERE bank_transaction_id='$OLD_ID';" \ + echo "UPDATE libeufin_bank.bank_account_transactions SET debtor_payto='payto://iban/DE68210501700012345678' WHERE bank_transaction_id='$OLD_ID';" \ | psql "${DB}" -At run_audit @@ -1116,7 +1106,7 @@ function test_9() { echo -n "Testing inconsistency detection... " check_report \ - misattribution-in-inconsistency \ + misattribution-in-inconsistencies \ "amount" "TESTKUDOS:10" echo -n "Testing balance update... " check_balance \ @@ -1191,7 +1181,7 @@ function test_11() { echo -n "Testing inconsistency detection... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "claimed" \ "TESTKUDOS:10" echo -n "Testing bad_amount_plus balance reporting... " @@ -1206,12 +1196,12 @@ function test_11() { "reported total_bad_amount_minus wrong" echo -n "Testing expected amount is correct... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "expected" \ "TESTKUDOS:0" echo -n "Testing diagnostic message is correct... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "diagnostic" \ "missing justification for outgoing wire transfer" full_reload @@ -1227,11 +1217,11 @@ function test_12() { echo "Checking output" # if an emergency was detected, that is a bug and we should fail echo -n "Test for emergencies... " - check_no_report "emergency" + check_no_report "emergencies" echo -n "Test for deposit confirmation detection... " - check_no_report "deposit-confirmation" + check_no_report "deposit-confirmations" echo -n "Test for emergencies by count... " - check_no_report "emergency-by-count" + check_no_report "emergencies-by-count" echo -n "Testing bad sig loss balance... " check_balance \ @@ -1336,7 +1326,7 @@ function test_12() { "Wrong arithmetic delta minus from reserves" echo -n "Checking for unexpected wire out differences... " - check_no_report "wire-out-inconsistency" + check_no_report "wire-out-inconsistencies" # Just to test the endpoint and for logging ... call_endpoint "balances" @@ -1396,10 +1386,10 @@ function test_12() { "Wrong arithmetic delta minus from reserves" echo -n "Checking amount arithmetic inconsistency" - check_no_report "amount-arithmetic-inconsistency" + check_no_report "amount-arithmetic-inconsistencies" echo -n "Checking for unexpected wire out differences " - check_no_report "wire-out-inconsistency" + check_no_report "wire-out-inconsistencies" echo -n "Checking total drained... " check_balance \ @@ -1462,11 +1452,11 @@ function test_14() { echo -n "Checking wire-fee inconsistency was detected ..." check_report \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "wire-fee" echo -n "Checking diagnostic was set correctly ..." check_report \ - "row-inconsistency" \ + "row-inconsistencies" \ "diagnostic" "wire fee signature invalid at given time" # cannot easily undo aggregator, hence full reload @@ -1535,12 +1525,12 @@ function test_16() { echo -n "Testing wire-out-inconsistency-expected... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "expected" \ "$OLD_AMOUNT" echo -n "Testing wire-out-inconsistency-claimed... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "claimed" \ "$NEW_AMOUNT" echo -n "Testing bad_amount_minus balance reporting... " @@ -1565,12 +1555,12 @@ function test_16() { echo -n "Testing wire-out-inconsistency-expected... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "expected" \ "$OLD_AMOUNT" echo -n "Testing wire-out-inconsistency-claimed... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "claimed" \ "$NEW_AMOUNT" echo -n "Testing bad_amount_minus balance reporting... " @@ -1623,7 +1613,7 @@ function test_17() { echo -n "Testing inconsistency diagnostic... " call_endpoint "row-minor-inconsistencies" - DIAG=$(jq -r .row_minor_inconsistencies[0].diagnostic < "${MY_TMP_DIR}/row-minor-inconsistencies.json" | awk '{print $1 " " $2 " " $3}') + DIAG=$(jq -r .records[0].diagnostic < "${MY_TMP_DIR}/row-minor-inconsistencies.json" | awk '{print $1 " " $2 " " $3}') if [ "$DIAG" != "execution date mismatch" ] then exit_fail "Reported diagnostic wrong: $DIAG" @@ -1648,19 +1638,19 @@ function test_18() { echo -n "Testing bad reserve balance summary reporting ... " # note: we check "suppressed" to only check the *existence* here. check_report \ - "reserve-balance-summary-wrong-inconsistency" \ + "reserve-balance-summary-wrong-inconsistencies" \ "suppressed" "false" echo -n "Testing emergency detection... " check_report \ - "emergency" \ + "emergencies" \ "suppressed" "false" echo -n "Testing emergency detection by count... " check_report \ - "emergency-by-count" \ + "emergencies-by-count" \ "suppressed" "false" echo -n "Testing escrow balance calculation impossibility... " check_report \ - "amount-arithmetic-inconsistency" \ + "amount-arithmetic-inconsistencies" \ "suppressed" "false" echo -n "Testing loss calculation by count... " check_not_balance \ @@ -1698,9 +1688,9 @@ function test_19() { check_auditor_running echo -n "Testing reserve closure was done correctly... " - check_no_report "reserve-not-closed-inconsistency" + check_no_report "reserve-not-closed-inconsistencies" echo -n "Testing no bogus transfers detected... " - check_no_report "wire-out-inconsistency" + check_no_report "wire-out-inconsistencies" # cannot easily undo aggregator, hence full reload full_reload @@ -1727,7 +1717,7 @@ function test_20() { echo -n "Testing reserve closure missing detected... " check_report \ - "reserve-not-closed-inconsistency" \ + "reserve-not-closed-inconsistencies" \ "suppressed" "false" echo -n "Testing balance updated correctly... " check_not_balance \ @@ -1817,9 +1807,9 @@ function test_22() { echo -n "Testing inconsistency detection... " check_report \ - "denomination-key-validity-withdraw-inconsistency" \ + "denomination-key-validity-withdraw-inconsistencies" \ "suppressed" "false" - call_endpoint "denomination-key-validity-withdraw-inconsistency" + call_endpoint "denomination-key-validity-withdraw-inconsistencies" # Undo modification echo "UPDATE exchange.denominations SET expire_withdraw=${OLD_WEXP} WHERE denominations_serial='${S_DENOM}';" | psql -Aqt "$DB" @@ -1846,11 +1836,11 @@ function test_23() { echo -n "Testing inconsistency detection... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "suppressed" "false" echo -n "Testing inconsistency row report... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "wire_out_row_id" "1" echo -n "Testing inconsistency balance... " check_balance \ @@ -1875,11 +1865,11 @@ function test_23() { echo -n "Testing inconsistency detection... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "suppressed" "false" echo -n "Testing inconsistency row report... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "wire_out_row_id" "1" echo -n "Testing inconsistency balance... " check_balance \ @@ -1916,7 +1906,7 @@ function test_24() { echo -n "Testing inconsistency detection... " call_endpoint "balances" check_report \ - "deposit-confirmation" \ + "deposit-confirmations" \ "suppressed" "false" echo -n "Testing inconsistency detection balance change ... " check_not_balance \ @@ -1944,17 +1934,17 @@ function test_25() { echo -n "Testing inconsistency detection... " check_report \ - "coin-inconsistency" \ + "coin-inconsistencies" \ "profitable" "true" echo -n "Testing emergency risk reporting... " check_report \ - "emergency" \ + "emergencies" \ "denom_risk" "TESTKUDOS:10" echo -n "Testing emergency loss reporting... " # The dropped refund covered coin deposit #2, so the deposit's full # amount is what the denomination is now short of. check_report \ - "emergency" \ + "emergencies" \ "denom_loss" "TESTKUDOS:7.02" echo -n "Testing double-spending reporting... " check_balance \ @@ -1992,7 +1982,7 @@ function test_26() { "coin_irregular_loss" \ "TESTKUDOS:3.02" \ "wrong total irregular coin loss" - call_endpoint "bad_sig_losses" + call_endpoint "bad-sig-losses" echo -n "Checking correct operation of loss reported... " check_report \ "bad-sig-losses" \ @@ -2037,7 +2027,7 @@ function test_27() { "operation" "wire" echo -n "Testing table attribution for inconsistency... " check_report \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "deposit" echo -n "Check signature loss was accumulated ..." check_not_balance \ @@ -2063,7 +2053,7 @@ function test_28() { echo -n "Testing inconsistency detection... " check_report \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "withdraw" # Undo full_reload @@ -2086,10 +2076,10 @@ function test_29() { "loss" "TESTKUDOS:0" echo -n "Testing inconsistency was reported as profitable... " check_report \ - "amount-arithmetic-inconsistency" \ + "amount-arithmetic-inconsistencies" \ "profitable" "true" echo -n "Testing no emergency was raised... " - check_no_report "emergency" + check_no_report "emergencies" # Undo echo "UPDATE exchange.denominations SET fee_refresh.frac=3000000 WHERE (coin).val=10;" | psql -Aqt "$DB" diff --git a/src/auditor/test-kyc.sh b/src/auditor/test-kyc.sh @@ -454,7 +454,7 @@ function call_endpoint() { function check_balance() { call_endpoint "balances" "$1" - BAL=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/${1}.json") + BAL=$(jq -r .records[0].balance_value < "${MY_TMP_DIR}/${1}.json") if [ "$BAL" != "$2" ] then exit_fail "$3 (got $BAL, wanted $2)" @@ -465,7 +465,7 @@ function check_balance() { function check_not_balance() { call_endpoint "balances" "$1" - BAL=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/${1}.json") + BAL=$(jq -r .records[0].balance_value < "${MY_TMP_DIR}/${1}.json") if [ "$BAL" = "$2" ] then exit_fail "$3 (got $BAL, wanted NOT $2)" @@ -476,9 +476,7 @@ function check_not_balance() { function check_report() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - VAL=$(jq -r .\"${NAME}\"[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") + VAL=$(jq -r .records[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") if [ "$VAL" != "$3" ] then exit_fail "$1::$2 (got $VAL, wanted $3)" @@ -493,9 +491,7 @@ function check_report() { # flagged once per operation that used it). function check_report_any() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - jq -e --arg want "$3" "any(.\"${NAME}\"[]; .\"$2\" == \$want)" \ + jq -e --arg want "$3" "any(.records[]; .\"$2\" == \$want)" \ < "${MY_TMP_DIR}/${1}.json" \ > /dev/null \ || exit_fail "$1::$2 (no entry with value $3)" @@ -507,9 +503,7 @@ function check_report_any() { # the exact amounts depend on how much of a reserve happened to be left. function check_some_report() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - jq -e .\"${NAME}\"[0] \ + jq -e .records[0] \ < "${MY_TMP_DIR}/${1}.json" \ > /dev/null \ || exit_fail "Wanted a report for $1, but got none" @@ -518,9 +512,7 @@ function check_some_report() { function check_no_report() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - jq -e .\"${NAME}\"[0] \ + jq -e .records[0] \ < "${MY_TMP_DIR}/${1}.json" \ > /dev/null \ && exit_fail "Wanted empty report for $1, but got incidents" @@ -529,9 +521,7 @@ function check_no_report() { function check_report_neg() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - VAL=$(jq -r .\"${NAME}\"[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") + VAL=$(jq -r .records[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") if [ "$VAL" == "$3" ] then exit_fail "$1::$2 (got $VAL, wanted $3)" @@ -541,7 +531,6 @@ function check_report_neg() { function check_row() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') if [ -n "${3+x}" ] then RID="$2" @@ -550,8 +539,7 @@ function check_row() { RID="row_id" WANT="$2" fi - # shellcheck disable=SC2086 - ROW=$(jq -r .\"${NAME}\"[0].\"${RID}\" < "${MY_TMP_DIR}/${1}.json") + ROW=$(jq -r .records[0].\"${RID}\" < "${MY_TMP_DIR}/${1}.json") if [ "$ROW" != "$WANT" ] then exit_fail "Row ${1} wrong (got ${ROW}, wanted ${WANT})" @@ -571,7 +559,7 @@ WITHHELD="TESTKUDOS:8.03" # hardcoded -- but the wire transfer identifier cannot: the aggregator draws it # with GNUNET_CRYPTO_random_block(), so tests 14 and 15 read it out of the # exchange's own tables instead of naming it. -BLOCKED_ACCOUNT="payto://iban/DE61109451?receiver-name=Blocked44" +BLOCKED_ACCOUNT="payto://iban/DE12500105170540732493?receiver-name=Blocked44" # Two KYCAUTH wire transfers of TESTKUDOS:0.1, one per merchant instance. KYCAUTH_IN="TESTKUDOS:0.2" # Everything the exchange's bank account was credited with: TESTKUDOS:56 of @@ -585,45 +573,45 @@ WIRE_IN="TESTKUDOS:56.2" # are zero, i.e. that nothing about this database looks wrong to it. function check_all_clean() { echo -n "Test for emergencies... " - check_no_report "emergency" + check_no_report "emergencies" echo -n "Test for emergencies by count... " - check_no_report "emergency-by-count" + check_no_report "emergencies-by-count" echo -n "Test for deposit confirmation problems... " - check_no_report "deposit-confirmation" + check_no_report "deposit-confirmations" echo -n "Test for denomination key validity problems... " - check_no_report "denomination-key-validity-withdraw-inconsistency" + check_no_report "denomination-key-validity-withdraw-inconsistencies" echo -n "Test for denominations without signatures... " check_no_report "denominations-without-sigs" echo -n "Test for wire out inconsistencies... " - check_no_report "wire-out-inconsistency" + check_no_report "wire-out-inconsistencies" echo -n "Test for reserve in inconsistencies... " - check_no_report "reserve-in-inconsistency" + check_no_report "reserve-in-inconsistencies" echo -n "Test for KYCAUTH in inconsistencies... " - check_no_report "kycauth-in-inconsistency" + check_no_report "kycauth-in-inconsistencies" echo -n "Test for misattribution inconsistencies... " - check_no_report "misattribution-in-inconsistency" + check_no_report "misattribution-in-inconsistencies" echo -n "Test for row inconsistencies... " - check_no_report "row-inconsistency" + check_no_report "row-inconsistencies" echo -n "Test for minor row inconsistencies... " check_no_report "row-minor-inconsistencies" echo -n "Test for wire format inconsistencies... " - check_no_report "wire-format-inconsistency" + check_no_report "wire-format-inconsistencies" echo -n "Test for arithmetic inconsistencies... " - check_no_report "amount-arithmetic-inconsistency" + check_no_report "amount-arithmetic-inconsistencies" echo -n "Test for coin inconsistencies... " - check_no_report "coin-inconsistency" + check_no_report "coin-inconsistencies" echo -n "Test for bad signature losses... " check_no_report "bad-sig-losses" echo -n "Test for fee time inconsistencies... " - check_no_report "fee-time-inconsistency" + check_no_report "fee-time-inconsistencies" echo -n "Test for purses not closed... " check_no_report "purse-not-closed-inconsistencies" echo -n "Test for reserves not closed... " - check_no_report "reserve-not-closed-inconsistency" + check_no_report "reserve-not-closed-inconsistencies" echo -n "Test for insufficient reserve balances... " - check_no_report "reserve-balance-insufficient-inconsistency" + check_no_report "reserve-balance-insufficient-inconsistencies" echo -n "Test for wrong reserve balance summaries... " - check_no_report "reserve-balance-summary-wrong-inconsistency" + check_no_report "reserve-balance-summary-wrong-inconsistencies" echo -n "Test for closure lags... " check_no_report "closure-lags" @@ -841,7 +829,7 @@ function check_kyc_state() { echo -n "Test for pending deposits... " check_no_report "pending-deposits" echo -n "Test for early aggregations... " - check_no_report "early-aggregation" + check_no_report "early-aggregations" } @@ -918,7 +906,7 @@ function test_2() { "Wrong KYCAUTH revenue" echo -n "Checking that the unbooked credit was flagged... " check_report_any \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "diagnostic" "unknown to exchange" echo -n "Checking that it was counted as an excess credit... " check_balance \ @@ -931,11 +919,11 @@ function test_2() { # so the auditor must not take the exchange's word for it. echo -n "Checking that the unconfirmed KYCAUTH was flagged... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "diagnostic" "KYCAUTH wire transfer claimed by exchange not found" echo -n "Checking the amount the exchange claims... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "amount_exchange_expected" "TESTKUDOS:0.1" echo -n "Checking that it was counted as a missing credit... " check_balance \ @@ -968,15 +956,15 @@ function test_3() { echo -n "Testing inconsistency detection... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "row_id" 1 echo -n "Testing amount wired... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_wired" "TESTKUDOS:10" echo -n "Testing amount expected... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_exchange_expected" "TESTKUDOS:5" echo -n "Checking wire credit balance plus... " check_balance \ @@ -1036,12 +1024,12 @@ function test_5() { echo -n "Testing wire-out-inconsistency expected... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "expected" \ "$CLEARED_WIRED" echo -n "Testing wire-out-inconsistency claimed... " check_report \ - "wire-out-inconsistency" \ + "wire-out-inconsistencies" \ "claimed" \ "TESTKUDOS:50" echo -n "Testing bad_amount_out_plus balance reporting... " @@ -1071,10 +1059,10 @@ function test_6() { echo -n "Checking reserve balance summary inconsistency detected... " check_some_report \ - "reserve-balance-summary-wrong-inconsistency" + "reserve-balance-summary-wrong-inconsistencies" echo -n "Testing amount the exchange expected... " check_report \ - "reserve-in-inconsistency" \ + "reserve-in-inconsistencies" \ "amount_exchange_expected" "TESTKUDOS:15" echo -n "Checking wire credit balance minus... " check_balance \ @@ -1149,11 +1137,11 @@ function test_8() { "Wrong KYCAUTH revenue" echo -n "Checking that the unbooked KYCAUTH was flagged... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "diagnostic" "unknown to exchange" echo -n "Checking the amount the bank reports... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "amount_wired" "TESTKUDOS:0.1" echo -n "Checking that it was counted as an excess credit... " check_balance \ @@ -1181,15 +1169,15 @@ function test_9() { echo -n "Checking that the mismatch was flagged... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "diagnostic" "wire amount does not match" echo -n "Checking the amount the exchange claims... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "amount_exchange_expected" "TESTKUDOS:5.1" echo -n "Checking the amount the bank reports... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "amount_wired" "TESTKUDOS:0.1" echo -n "Checking that the shortfall was counted... " check_balance \ @@ -1236,7 +1224,7 @@ function test_10() { echo -n "Checking that the unbooked transfer was reported... " check_report_any \ - "kycauth-in-inconsistency" \ + "kycauth-in-inconsistencies" \ "diagnostic" "unknown to exchange" echo -n "Checking that it was counted as an excess credit... " check_balance \ @@ -1265,7 +1253,7 @@ function test_10() { echo " DONE" echo -n "Checking that the report was retracted... " - check_no_report "kycauth-in-inconsistency" + check_no_report "kycauth-in-inconsistencies" echo -n "Checking that the excess credit was retracted too... " check_balance \ "total_bad_amount_in_plus" \ @@ -1301,11 +1289,11 @@ function test_11() { echo -n "Checking that the appointment was flagged... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "diagnostic" "invalid master key signature on staff status" echo -n "Checking that it was blamed on the right table... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "aml_staff" # aml_staff is append-only, so the helper can and must resume from where @@ -1361,15 +1349,15 @@ function test_12() { echo -n "Checking that the bad signature was flagged... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "diagnostic" "invalid officer signature on decision" echo -n "Checking that the missing appointment was flagged... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "diagnostic" "officer was not appointed when the decision was made" echo -n "Checking that it was blamed on the right table... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "aml_history" full_reload @@ -1406,22 +1394,22 @@ function test_13() { echo -n "Checking that the unjustified outcome was flagged... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "diagnostic" \ "KYC rules in force without an AML decision, a legitimization process or an expired predecessor" echo -n "Checking that it was blamed on the right table... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "legitimization_outcomes" # Only the injected row is bad. The outcomes the reference database # earned honestly are each accounted for by a legitimization process or # an AML decision, and reporting those too would make the check useless. echo -n "Checking that the honest outcomes were left alone... " - BAD=$(jq -r '[.row_inconsistency[] + BAD=$(jq -r '[.records[] | select(.row_table == "legitimization_outcomes")] | length' \ - < "${MY_TMP_DIR}/row-inconsistency.json") + < "${MY_TMP_DIR}/row-inconsistencies.json") if [ "$BAD" != "1" ] then exit_fail "wanted exactly 1 bad legitimization outcome, got $BAD" @@ -1559,7 +1547,7 @@ function test_15() { "$BLOCKED_ACCOUNT" echo -n "Checking that the stale claim was reported... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "aggregation_deferrals" full_reload @@ -1615,7 +1603,7 @@ function test_16() { check_report "aml-holds" "deferral_reason" "AMOUNT_TOO_SMALL" echo -n "Checking that the contradiction with the transient was reported... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "aggregation_transient" full_reload diff --git a/src/auditor/test-revocation.sh b/src/auditor/test-revocation.sh @@ -247,7 +247,7 @@ function call_endpoint() { function check_balance() { call_endpoint "balances" "$1" - BAL=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/${1}.json") + BAL=$(jq -r .records[0].balance_value < "${MY_TMP_DIR}/${1}.json") if [ "$BAL" != "$2" ] then exit_fail "$3 (got $BAL, wanted $2)" @@ -258,7 +258,7 @@ function check_balance() { function check_not_balance() { call_endpoint "balances" "$1" - BAL=$(jq -r .balances[0].balance_value < "${MY_TMP_DIR}/${1}.json") + BAL=$(jq -r .records[0].balance_value < "${MY_TMP_DIR}/${1}.json") if [ "$BAL" = "$2" ] then exit_fail "$3 (got $BAL, wanted NOT $2)" @@ -269,9 +269,7 @@ function check_not_balance() { function check_report() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - VAL=$(jq -r .\"${NAME}\"[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") + VAL=$(jq -r .records[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") if [ "$VAL" != "$3" ] then exit_fail "$1::$2 (got $VAL, wanted $3)" @@ -282,9 +280,7 @@ function check_report() { function check_no_report() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - jq -e .\"${NAME}\"[0] \ + jq -e .records[0] \ < "${MY_TMP_DIR}/${1}.json" \ > /dev/null \ && exit_fail "Wanted empty report for $1, but got incidents" @@ -294,9 +290,7 @@ function check_no_report() { function check_report_neg() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - VAL=$(jq -r .\"${NAME}\"[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") + VAL=$(jq -r .records[0].\"$2\" < "${MY_TMP_DIR}/${1}.json") if [ "$VAL" == "$3" ] then exit_fail "$1::$2 (got $VAL, wanted $3)" @@ -308,9 +302,7 @@ function check_report_neg() { # Check that at least one entry of report $1 has field $2 set to $3. function check_report_any() { call_endpoint "$1" - NAME=$(echo "$1" | tr '-' '_') - # shellcheck disable=SC2086 - jq -e --arg want "$3" "any(.\"${NAME}\"[]; .\"$2\" == \$want)" \ + jq -e --arg want "$3" "any(.records[]; .\"$2\" == \$want)" \ < "${MY_TMP_DIR}/${1}.json" \ > /dev/null \ || exit_fail "$1::$2 (no entry with value $3)" @@ -357,19 +349,19 @@ function test_0() { echo "Checking output" # if an emergency was detected, that is a bug and we should fail echo -n "Test for emergencies... " - check_no_report "emergency" + check_no_report "emergencies" echo -n "Test for emergencies by count... " - check_no_report "emergency-by-count" + check_no_report "emergencies-by-count" echo -n "Test for deposit confirmation problems... " - check_no_report "deposit-confirmation" + check_no_report "deposit-confirmations" echo -n "Test for wire inconsistencies... " - check_no_report "denomination-key-validity-withdraw-inconsistency" - check_no_report "wire-out-inconsistency" - check_no_report "reserve-in-inconsistency" - check_no_report "misattribution-in-inconsistency" - check_no_report "row-inconsistency" + check_no_report "denomination-key-validity-withdraw-inconsistencies" + check_no_report "wire-out-inconsistencies" + check_no_report "reserve-in-inconsistencies" + check_no_report "misattribution-in-inconsistencies" + check_no_report "row-inconsistencies" check_no_report "row-minor-inconsistencies" - check_no_report "wire-format-inconsistency" + check_no_report "wire-format-inconsistencies" # Just to test the endpoint and for logging ... call_endpoint "balances" @@ -448,7 +440,7 @@ function test_0() { "Wrong arithmetic delta minus from reserves" echo -n "Checking for unexpected arithmetic inconsistencies... " - check_no_report "amount-arithmetic-inconsistency" + check_no_report "amount-arithmetic-inconsistencies" # cannot easily undo aggregator, hence full reload full_reload @@ -466,17 +458,17 @@ function test_1() { echo "Checking output" # if an emergency was detected, that is a bug and we should fail echo -n "Test for emergencies... " - check_no_report "emergency" + check_no_report "emergencies" echo -n "Test for emergencies by count... " - check_no_report "emergency-by-count" + check_no_report "emergencies-by-count" echo -n "Test for wire inconsistencies... " - check_no_report "wire-out-inconsistency" - check_no_report "reserve-in-inconsistency" - check_no_report "misattribution-in-inconsistency" - check_no_report "row-inconsistency" + check_no_report "wire-out-inconsistencies" + check_no_report "reserve-in-inconsistencies" + check_no_report "misattribution-in-inconsistencies" + check_no_report "row-inconsistencies" check_no_report "row-minor-inconsistencies" - check_no_report "wire-format-inconsistency" + check_no_report "wire-format-inconsistencies" echo -n "Test for bad incoming delta plus... " check_balance \ @@ -512,18 +504,18 @@ function test_2() { # Reserve balance is now wrong echo -n "Testing reserve balance inconsistency detection... " check_report \ - "reserve-balance-summary-wrong-inconsistency" \ + "reserve-balance-summary-wrong-inconsistencies" \ "auditor_amount" "TESTKUDOS:3" check_report \ - "reserve-balance-summary-wrong-inconsistency" \ + "reserve-balance-summary-wrong-inconsistencies" \ "exchange_amount" "TESTKUDOS:0" # Coin spent exceeded coin's value echo -n "Testing coin arithmetic inconsistency detection... " check_report \ - "amount-arithmetic-inconsistency" \ + "amount-arithmetic-inconsistencies" \ "auditor_amount" "TESTKUDOS:2" check_report \ - "amount-arithmetic-inconsistency" \ + "amount-arithmetic-inconsistencies" \ "exchange_amount" "TESTKUDOS:5" echo "OK" @@ -581,7 +573,7 @@ function test_4() { "Total bad sig losses are wrong" echo -n "Testing row inconsistency table attribution... " check_report_any \ - "row-inconsistency" \ + "row-inconsistencies" \ "row_table" "recoup" echo "OK" diff --git a/src/auditordb/drop.sql b/src/auditordb/drop.sql @@ -25,7 +25,7 @@ WITH xpatches AS ( SELECT _v.unregister_patch(xpatches.patch_name) FROM xpatches; -DROP SCHEMA auditor CASCADE; +DROP SCHEMA IF EXISTS auditor CASCADE; -- And we're out of here... COMMIT; diff --git a/src/auditordb/helper.c b/src/auditordb/helper.c @@ -52,6 +52,8 @@ TALER_AUDITORDB_get_deletable_suppressable_table_name ( "auditor_wire_out_inconsistency", "auditor_kycauth_in_inconsistency", "auditor_aml_holds", + "auditor_early_aggregations", + "auditor_pending_deposits", NULL, }; diff --git a/src/include/auditordb_lib.h b/src/include/auditordb_lib.h @@ -648,6 +648,16 @@ enum TALER_AUDITORDB_DeletableSuppressableTables TALER_AUDITORDB_AML_HOLDS, /** + * For auditor_early_aggregations table. + */ + TALER_AUDITORDB_EARLY_AGGREGATIONS, + + /** + * For auditor_pending_deposits table. + */ + TALER_AUDITORDB_PENDING_DEPOSITS, + + /** * Terminal. */ TALER_AUDITORDB_DELETABLESUPPRESSABLE_TABLES_MAX diff --git a/src/testing/taler-unified-setup.sh b/src/testing/taler-unified-setup.sh @@ -331,11 +331,10 @@ register_bank_account() { # hostname OPERATOR="localhost" MAYBE_IBAN="$1" + PAYTO="payto://${WIRE_DOMAIN}/${OPERATOR}/${MAYBE_IBAN}?receiver-name=$ENAME" else - # BIC - OPERATOR="SANDBOXX" + PAYTO="payto://${WIRE_DOMAIN}/${MAYBE_IBAN}?receiver-name=$ENAME" fi - PAYTO="payto://${WIRE_DOMAIN}/${OPERATOR}/${MAYBE_IBAN}?receiver-name=$ENAME" BODY='{"username":"'"$1"'","password":"'"$2"'","is_taler_exchange":'"$IS_EXCHANGE"',"name":"'"$3"'","payto_uri":"'"$PAYTO"'"}' else BODY='{"username":"'"$1"'","password":"'"$2"'","is_taler_exchange":'"$IS_EXCHANGE"',"name":"'"$3"'"}' @@ -513,7 +512,7 @@ then # call. register_bank_account fortytwo password "User42" FR7630006000011234567890189 register_bank_account fortythree password "Forty Three" - register_bank_account exchange password "Exchange Company" DE989651 + register_bank_account exchange password "Exchange Company" DE89370400440532013000 register_bank_account tor password "Tor Project" register_bank_account gnunet password "GNUnet" register_bank_account tutorial password "Tutorial"