diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-09-17 11:27:33 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-09-17 11:27:33 +0200 |
commit | 9ae46f367e606f9b3866b361459e05a71be9f310 (patch) | |
tree | 8ebc0edf84cc745a75b9c8ff4b550a40a08c9ca8 /src/exchangedb | |
parent | 535c57b2f9660e4178b31e2a0c47444b00348b71 (diff) | |
download | exchange-9ae46f367e606f9b3866b361459e05a71be9f310.tar.xz |
first cut for API to get coin history
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/pg_get_coin_transactions.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_get_coin_transactions.h | 9 | ||||
-rw-r--r-- | src/exchangedb/test_exchangedb.c | 13 |
3 files changed, 19 insertions, 5 deletions
diff --git a/src/exchangedb/pg_get_coin_transactions.c b/src/exchangedb/pg_get_coin_transactions.c index 4f4317920..704e7c5c5 100644 --- a/src/exchangedb/pg_get_coin_transactions.c +++ b/src/exchangedb/pg_get_coin_transactions.c @@ -684,6 +684,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_get_coin_transactions ( void *cls, const struct TALER_CoinSpendPublicKeyP *coin_pub, + uint64_t *etag, struct TALER_EXCHANGEDB_TransactionList **tlp) { struct PostgresClosure *pg = cls; @@ -729,6 +730,7 @@ TEH_PG_get_coin_transactions ( .db_cls = cls }; + *etag = 0; // FIXME: etag not yet implemented! PREPARE (pg, // done! "get_deposit_with_coin_pub", "SELECT" diff --git a/src/exchangedb/pg_get_coin_transactions.h b/src/exchangedb/pg_get_coin_transactions.h index c95fd0947..d49b97bc6 100644 --- a/src/exchangedb/pg_get_coin_transactions.h +++ b/src/exchangedb/pg_get_coin_transactions.h @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2022 Taler Systems SA + Copyright (C) 2022, 2023 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 @@ -29,16 +29,21 @@ /** * Compile a list of all (historic) transactions performed with the given coin * (/refresh/melt, /deposit, /refund and /recoup operations). + * Should return 0 if @a etag is already current, otherwise + * return the full history and update @a etag. @a etag + * should be set to the last row ID of the given coin + * in the coin history table. * * @param cls the `struct PostgresClosure` with the plugin-specific state * @param coin_pub coin to investigate - * @param[out] tlp set to list of transactions, NULL if coin is fresh + * @param[in,out] etag known etag, updated to current etag * @param[out] tlp set to list of transactions, NULL if coin is fresh * @return database transaction status */ enum GNUNET_DB_QueryStatus TEH_PG_get_coin_transactions ( void *cls, const struct TALER_CoinSpendPublicKeyP *coin_pub, + uint64_t *etag, struct TALER_EXCHANGEDB_TransactionList **tlp); #endif diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index 56925acf0..217df2bb4 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -1723,9 +1723,11 @@ run (void *cls) /* Just to test fetching a coin with melt history */ struct TALER_EXCHANGEDB_TransactionList *tl; enum GNUNET_DB_QueryStatus qs; + uint64_t etag = 0; qs = plugin->get_coin_transactions (plugin->cls, &refresh.coin.coin_pub, + &etag, &tl); FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs); plugin->free_coin_transaction_list (plugin->cls, @@ -1972,9 +1974,14 @@ run (void *cls) &audit_refund_cb, NULL)); FAILIF (1 != auditor_row_cnt); - qs = plugin->get_coin_transactions (plugin->cls, - &refund.coin.coin_pub, - &tl); + { + uint64_t etag = 0; + + qs = plugin->get_coin_transactions (plugin->cls, + &refund.coin.coin_pub, + &etag, + &tl); + } FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs); GNUNET_assert (NULL != tl); matched = 0; |