summaryrefslogtreecommitdiff
path: root/src/auditor/taler-helper-auditor-coins.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-12 17:23:31 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-12 17:23:36 +0200
commit393ae7f9a3536569dde87cab8055693d6f1bd924 (patch)
treefeb303000c95740da3631bdea6a6cf33ac8009e7 /src/auditor/taler-helper-auditor-coins.c
parente71782ea777efce86342def929ed55330762a16d (diff)
downloadexchange-393ae7f9a3536569dde87cab8055693d6f1bd924.tar.gz
exchange-393ae7f9a3536569dde87cab8055693d6f1bd924.tar.bz2
exchange-393ae7f9a3536569dde87cab8055693d6f1bd924.zip
-add dB logic for auditor iteration over purse deposits
Diffstat (limited to 'src/auditor/taler-helper-auditor-coins.c')
-rw-r--r--src/auditor/taler-helper-auditor-coins.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index c75899571..161ae40bc 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -2216,6 +2216,30 @@ check_denomination (
/**
+ * Function called with details about purse deposits that have been made, with
+ * the goal of auditing the deposit's execution.
+ *
+ * @param cls closure
+ * @param rowid unique serial ID for the deposit in our DB
+ * @param deposit deposit details
+ * @param denom_pub denomination public key of @a coin_pub
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
+ */
+static enum GNUNET_GenericReturnValue
+purse_deposit_cb (
+ void *cls,
+ uint64_t rowid,
+ const struct TALER_EXCHANGEDB_PurseDeposit *deposit,
+ const struct TALER_DenominationPublicKey *denom_pub)
+{
+ struct CoinContext *cc = cls;
+
+ GNUNET_break (0); // FIXME: not implemented!
+ return GNUNET_SYSERR;
+}
+
+
+/**
* Analyze the exchange's processing of coins.
*
* @param cls closure
@@ -2259,12 +2283,13 @@ analyze_coins (void *cls)
{
ppc_start = ppc;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Resuming coin audit at %llu/%llu/%llu/%llu/%llu\n",
+ "Resuming coin audit at %llu/%llu/%llu/%llu/%llu/%llu\n",
(unsigned long long) ppc.last_deposit_serial_id,
(unsigned long long) ppc.last_melt_serial_id,
(unsigned long long) ppc.last_refund_serial_id,
(unsigned long long) ppc.last_withdraw_serial_id,
- (unsigned long long) ppc.last_recoup_refresh_serial_id);
+ (unsigned long long) ppc.last_recoup_refresh_serial_id,
+ (unsigned long long) ppc.last_purse_deposits_serial_id);
}
/* setup 'cc' */
@@ -2368,6 +2393,20 @@ analyze_coins (void *cls)
if (0 > cc.qs)
return cc.qs;
+ /* process purse_deposits */
+ if (0 >
+ (qs = TALER_ARL_edb->select_purse_deposits_above_serial_id (
+ TALER_ARL_edb->cls,
+ ppc.last_purse_deposits_serial_id,
+ &purse_deposit_cb,
+ &cc)))
+ {
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ return qs;
+ }
+ if (0 > cc.qs)
+ return cc.qs;
+
/* sync 'cc' back to disk */
cc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
GNUNET_CONTAINER_multihashmap_iterate (cc.denom_summaries,
@@ -2421,12 +2460,13 @@ analyze_coins (void *cls)
return qs;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Concluded coin audit step at %llu/%llu/%llu/%llu/%llu\n",
+ "Concluded coin audit step at %llu/%llu/%llu/%llu/%llu/%llu\n",
(unsigned long long) ppc.last_deposit_serial_id,
(unsigned long long) ppc.last_melt_serial_id,
(unsigned long long) ppc.last_refund_serial_id,
(unsigned long long) ppc.last_withdraw_serial_id,
- (unsigned long long) ppc.last_recoup_refresh_serial_id);
+ (unsigned long long) ppc.last_recoup_refresh_serial_id,
+ (unsigned long long) ppc.last_purse_deposits_serial_id);
return qs;
}