From fe9b3bc322ba5e92d3e08c04e103fc9acb92e888 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 1 Apr 2024 21:11:21 +0200 Subject: nicer logging --- src/backend/taler-merchant-exchange.c | 26 +++++++++++++++++----- .../pg_lookup_deposits_by_contract_and_coin.c | 6 +++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/backend/taler-merchant-exchange.c b/src/backend/taler-merchant-exchange.c index 80802956..7945cb50 100644 --- a/src/backend/taler-merchant-exchange.c +++ b/src/backend/taler-merchant-exchange.c @@ -727,8 +727,25 @@ check_transfer (void *cls, TALER_amount_cmp_currency (amount_with_fee, &ttd->coin_value)) || (0 != TALER_amount_cmp (amount_with_fee, - &ttd->coin_value)) || - (GNUNET_OK != + &ttd->coin_value)) ) + { + /* Disagreement between the exchange and us about how much this + coin is worth! */ + GNUNET_break_op (0); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Disagreement about coin value %s\n", + TALER_amount2s (amount_with_fee)); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Exchange gave it a value of %s\n", + TALER_amount2s (&ttd->coin_value)); + ctc->check_transfer_result = GNUNET_SYSERR; + /* Build the `TrackTransferConflictDetails` */ + ctc->ec = TALER_EC_MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS; + ctc->failure = true; + /* FIXME: this should be reported to the auditor (once the auditor has an API for this) */ + return; + } + if ( (GNUNET_OK != TALER_amount_cmp_currency (deposit_fee, &ttd->coin_fee)) || (0 != TALER_amount_cmp (deposit_fee, @@ -737,14 +754,11 @@ check_transfer (void *cls, /* Disagreement between the exchange and us about how much this coin is worth! */ GNUNET_break_op (0); - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Disagreement about coin value %s\n", - TALER_amount2s (&ttd->coin_value)); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Expected fee is %s\n", TALER_amount2s (&ttd->coin_fee)); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Fee of exchange is %s\n", + "Fee claimed by exchange is %s\n", TALER_amount2s (deposit_fee)); ctc->check_transfer_result = GNUNET_SYSERR; /* Build the `TrackTransferConflictDetails` */ diff --git a/src/backenddb/pg_lookup_deposits_by_contract_and_coin.c b/src/backenddb/pg_lookup_deposits_by_contract_and_coin.c index 29ff3926..e585bd91 100644 --- a/src/backenddb/pg_lookup_deposits_by_contract_and_coin.c +++ b/src/backenddb/pg_lookup_deposits_by_contract_and_coin.c @@ -90,6 +90,9 @@ lookup_refunds_cb (void *cls, ldcc->qs = GNUNET_DB_STATUS_HARD_ERROR; return; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Coin had refund of %s\n", + TALER_amount2s (&refund_amount)); if (0 == i) ldcc->refund_total = refund_amount; else @@ -164,6 +167,9 @@ lookup_deposits_by_contract_and_coin_cb (void *cls, } if (TALER_amount_is_valid (&ldcc->refund_total)) { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Coin had total refunds of %s\n", + TALER_amount2s (&ldcc->refund_total)); if (1 == TALER_amount_cmp (&ldcc->refund_total, &amount_with_fee)) -- cgit v1.2.3