commit 2d3fcf511582a69f4ee18a671b6cb2fba2dbdff6
parent 9626af456f4397102d0197134a9fc1140478b5a0
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 22 Jul 2017 16:10:50 +0200
do not use uninitialized master_pub field from 'struct Exchange', but use the initialized master_pub from keys instead (when storing wire fee data in the database), should complete #4943 implementation
Diffstat:
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c
@@ -312,7 +312,12 @@ process_wire_fees (void *cls,
struct FeesByWireMethod *f;
struct TALER_EXCHANGE_WireAggregateFees *endp;
struct TALER_EXCHANGE_WireAggregateFees *af;
-
+ const struct TALER_EXCHANGE_Keys *keys;
+ const struct TALER_MasterPublicKeyP *master_pub;
+
+ keys = TALER_EXCHANGE_get_keys (exchange->conn);
+ GNUNET_assert (NULL != keys);
+ master_pub = &keys->master_pub;
for (f = exchange->wire_fees_head; NULL != f; f = f->next)
if (0 == strcasecmp (wire_method,
f->wire_method))
@@ -349,8 +354,14 @@ process_wire_fees (void *cls,
GNUNET_CRYPTO_hash (wire_method,
strlen (wire_method) + 1,
&h_wire_method);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Storing wire fee for `%s' and method `%s' at %s in DB; the fee is %s\n",
+ TALER_B2S (master_pub),
+ wire_method,
+ GNUNET_STRINGS_absolute_time_to_string (af->start_date),
+ TALER_amount2s (&af->wire_fee));
qs = db->store_wire_fee_by_exchange (db->cls,
- &exchange->master_pub,
+ master_pub,
&h_wire_method,
&af->wire_fee,
&af->closing_fee,
diff --git a/src/backend/taler-merchant-httpd_track-transfer.c b/src/backend/taler-merchant-httpd_track-transfer.c
@@ -533,8 +533,9 @@ check_wire_fee (struct TrackTransferContext *rctx,
if (0 >= qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to find wire fee for `%s' at %s in DB, accepting blindly that the fee is %s\n",
+ "Failed to find wire fee for `%s' and method `%s' at %s in DB, accepting blindly that the fee is %s\n",
TALER_B2S (master_pub),
+ rctx->wire_method,
GNUNET_STRINGS_absolute_time_to_string (execution_time),
TALER_amount2s (wire_fee));
return GNUNET_NO;