commit 6b61d0944e0b7dcc5edeb1b218624d882199931f
parent daaa5f3d6e5a1594514fadffdd6e54ba8d7caba2
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 20 Jun 2025 15:59:54 +0200
fix coin history implementation with new crypto-mas (#9975) -- client side, plus ABI version bump
Diffstat:
3 files changed, 43 insertions(+), 33 deletions(-)
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
@@ -1652,6 +1652,11 @@ struct TALER_EXCHANGE_CoinHistoryEntry
struct TALER_Amount amount;
/**
+ * Offset of this entry in the coin history table.
+ */
+ uint64_t history_offset;
+
+ /**
* Details depending on @e type.
*/
union
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
@@ -18,7 +18,7 @@ lib_LTLIBRARIES = \
libtalerexchange.la
libtalerexchange_la_LDFLAGS = \
- -version-info 17:0:1 \
+ -version-info 18:0:0 \
-no-undefined
libtalerexchange_la_SOURCES = \
exchange_api_add_aml_decision.c \
diff --git a/src/lib/exchange_api_coins_history.c b/src/lib/exchange_api_coins_history.c
@@ -143,34 +143,34 @@ help_deposit (struct CoinHistoryParseContext *pc,
json_t *transaction)
{
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("coin_sig",
- &rh->details.deposit.sig),
+ TALER_JSON_spec_amount_any ("deposit_fee",
+ &rh->details.deposit.deposit_fee),
+ GNUNET_JSON_spec_fixed_auto ("merchant_pub",
+ &rh->details.deposit.merchant_pub),
+ GNUNET_JSON_spec_timestamp ("timestamp",
+ &rh->details.deposit.wallet_timestamp),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &rh->details.deposit.refund_deadline),
+ NULL),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&rh->details.deposit.h_contract_terms),
+ GNUNET_JSON_spec_fixed_auto ("h_wire",
+ &rh->details.deposit.h_wire),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_fixed_auto ("h_policy",
+ &rh->details.deposit.h_policy),
+ &rh->details.deposit.no_h_policy),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("wallet_data_hash",
&rh->details.deposit.wallet_data_hash),
&rh->details.deposit.no_wallet_data_hash),
- GNUNET_JSON_spec_fixed_auto ("h_wire",
- &rh->details.deposit.h_wire),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
&rh->details.deposit.hac),
&rh->details.deposit.no_hac),
- GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_fixed_auto ("h_policy",
- &rh->details.deposit.h_policy),
- &rh->details.deposit.no_h_policy),
- GNUNET_JSON_spec_timestamp ("timestamp",
- &rh->details.deposit.wallet_timestamp),
- GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_timestamp ("refund_deadline",
- &rh->details.deposit.refund_deadline),
- NULL),
- TALER_JSON_spec_amount_any ("deposit_fee",
- &rh->details.deposit.deposit_fee),
- GNUNET_JSON_spec_fixed_auto ("merchant_pub",
- &rh->details.deposit.merchant_pub),
+ GNUNET_JSON_spec_fixed_auto ("coin_sig",
+ &rh->details.deposit.sig),
GNUNET_JSON_spec_end ()
};
@@ -240,16 +240,18 @@ help_melt (struct CoinHistoryParseContext *pc,
json_t *transaction)
{
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("coin_sig",
- &rh->details.melt.sig),
+ TALER_JSON_spec_amount_any ("melt_fee",
+ &rh->details.melt.melt_fee),
GNUNET_JSON_spec_fixed_auto ("rc",
&rh->details.melt.rc),
+ // FIXME: also return refresh_seed?
+ // FIXME: also return blinding_seed?
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
&rh->details.melt.h_age_commitment),
&rh->details.melt.no_hac),
- TALER_JSON_spec_amount_any ("melt_fee",
- &rh->details.melt.melt_fee),
+ GNUNET_JSON_spec_fixed_auto ("coin_sig",
+ &rh->details.melt.sig),
GNUNET_JSON_spec_end ()
};
@@ -311,14 +313,14 @@ help_refund (struct CoinHistoryParseContext *pc,
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("refund_fee",
&rh->details.refund.refund_fee),
- GNUNET_JSON_spec_fixed_auto ("merchant_sig",
- &rh->details.refund.sig),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&rh->details.refund.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("merchant_pub",
&rh->details.refund.merchant_pub),
GNUNET_JSON_spec_uint64 ("rtransaction_id",
&rh->details.refund.rtransaction_id),
+ GNUNET_JSON_spec_fixed_auto ("merchant_sig",
+ &rh->details.refund.sig),
GNUNET_JSON_spec_end ()
};
@@ -575,18 +577,19 @@ help_purse_deposit (struct CoinHistoryParseContext *pc,
json_t *transaction)
{
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("purse_pub",
- &rh->details.purse_deposit.purse_pub),
- GNUNET_JSON_spec_fixed_auto ("coin_sig",
- &rh->details.purse_deposit.coin_sig),
+ TALER_JSON_spec_web_url ("exchange_base_url",
+ &rh->details.purse_deposit.exchange_base_url),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
&rh->details.purse_deposit.phac),
NULL),
- TALER_JSON_spec_web_url ("exchange_base_url",
- &rh->details.purse_deposit.exchange_base_url),
+ // FIXME: return deposit_fee?
+ GNUNET_JSON_spec_fixed_auto ("purse_pub",
+ &rh->details.purse_deposit.purse_pub),
GNUNET_JSON_spec_bool ("refunded",
&rh->details.purse_deposit.refunded),
+ GNUNET_JSON_spec_fixed_auto ("coin_sig",
+ &rh->details.purse_deposit.coin_sig),
GNUNET_JSON_spec_end ()
};
@@ -647,12 +650,12 @@ help_purse_refund (struct CoinHistoryParseContext *pc,
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("refund_fee",
&rh->details.purse_refund.refund_fee),
- GNUNET_JSON_spec_fixed_auto ("purse_pub",
- &rh->details.purse_refund.purse_pub),
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
&rh->details.purse_refund.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&rh->details.purse_refund.exchange_pub),
+ GNUNET_JSON_spec_fixed_auto ("purse_pub",
+ &rh->details.purse_refund.purse_pub),
GNUNET_JSON_spec_end ()
};
@@ -817,6 +820,8 @@ TALER_EXCHANGE_parse_coin_history (
&rh->amount),
GNUNET_JSON_spec_string ("type",
&type),
+ GNUNET_JSON_spec_uint64 ("history_offset",
+ &rh->history_offset),
GNUNET_JSON_spec_end ()
};