summaryrefslogtreecommitdiff
path: root/src/auditor
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-20 04:17:06 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-20 04:17:06 +0100
commit73321daf5a30498143a1185c74bb272c5cdc7428 (patch)
treed855c9b812aa55d48e7f38f2243c572ad38502eb /src/auditor
parent9fe8da0cc6253f21e8aead7a600ae8f41b9f2693 (diff)
downloadexchange-73321daf5a30498143a1185c74bb272c5cdc7428.tar.gz
exchange-73321daf5a30498143a1185c74bb272c5cdc7428.tar.bz2
exchange-73321daf5a30498143a1185c74bb272c5cdc7428.zip
deal with persisting wire/aggregation fee data in auditor
Diffstat (limited to 'src/auditor')
-rw-r--r--src/auditor/taler-auditor.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index 24228da5f..04e9da98b 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -1923,6 +1923,7 @@ analyze_aggregations (void *cls)
struct AggregationContext ac;
struct WirePlugin *wc;
struct WireFeeInfo *wfi;
+ int have_balance;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Analyzing aggregations\n");
@@ -1931,10 +1932,19 @@ analyze_aggregations (void *cls)
ac.wire_tail = NULL;
ac.fee_head = NULL;
ac.fee_tail = NULL;
- /* FIXME: load existing value from DB! */
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (currency,
- &ac.total_aggregation_fees));
+ have_balance = adb->get_wire_fee_summary (adb->cls,
+ asession,
+ &master_pub,
+ &ac.total_aggregation_fees);
+ if (GNUNET_SYSERR == have_balance)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ if (GNUNET_NO == have_balance)
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_get_zero (currency,
+ &ac.total_aggregation_fees));
if (GNUNET_SYSERR ==
edb->select_wire_out_above_serial_id (edb->cls,
esession,
@@ -1966,9 +1976,23 @@ analyze_aggregations (void *cls)
GNUNET_break (0);
return GNUNET_SYSERR;
}
- /* FIXME: store aggregation fee total to DB! */
+ if (GNUNET_NO == have_balance)
+ ac.ret = adb->insert_wire_fee_summary (adb->cls,
+ asession,
+ &master_pub,
+ &ac.total_aggregation_fees);
+ else
+ ac.ret = adb->update_wire_fee_summary (adb->cls,
+ asession,
+ &master_pub,
+ &ac.total_aggregation_fees);
+ if (GNUNET_OK != ac.ret)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
report_aggregation_fee_balance (&ac.total_aggregation_fees);
- return ac.ret;
+ return GNUNET_OK;
}