From d3a63881999aa1c6d763263346a0a5979ec6efac Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 8 May 2022 11:37:37 +0200 Subject: pass purse_fee to determine how purse creation is paid for --- src/util/wallet_signatures.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/util') diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c index 85caaca6e..27a28256c 100644 --- a/src/util/wallet_signatures.c +++ b/src/util/wallet_signatures.c @@ -1062,6 +1062,12 @@ struct TALER_AccountMergePS */ struct TALER_AmountNBO purse_amount; + /** + * Purse creation fee to be paid by the reserve for + * this operation. + */ + struct TALER_AmountNBO purse_fee; + /** * Contract this purse pays for. */ @@ -1078,9 +1084,16 @@ struct TALER_AccountMergePS struct GNUNET_TIME_TimestampNBO merge_timestamp; /** - * Minimum age required for payments into this purse. + * Minimum age required for payments into this purse, + * in NBO. */ uint32_t min_age GNUNET_PACKED; + + /** + * Flags for the operation, in NBO. See + * `enum TALER_WalletAccountMergeFlags`. + */ + uint32_t flags GNUNET_PACKED; }; @@ -1091,7 +1104,9 @@ TALER_wallet_account_merge_sign ( struct GNUNET_TIME_Timestamp purse_expiration, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_Amount *amount, + const struct TALER_Amount *purse_fee, uint32_t min_age, + enum TALER_WalletAccountMergeFlags flags, const struct TALER_ReservePrivateKeyP *reserve_priv, struct TALER_ReserveSignatureP *reserve_sig) { @@ -1102,11 +1117,14 @@ TALER_wallet_account_merge_sign ( .purse_pub = *purse_pub, .purse_expiration = GNUNET_TIME_timestamp_hton (purse_expiration), .h_contract_terms = *h_contract_terms, - .min_age = htonl (min_age) + .min_age = htonl (min_age), + .flags = htonl ((uint32_t) flags) }; TALER_amount_hton (&pm.purse_amount, amount); + TALER_amount_hton (&pm.purse_fee, + purse_fee); GNUNET_CRYPTO_eddsa_sign (&reserve_priv->eddsa_priv, &pm, &reserve_sig->eddsa_signature); @@ -1120,7 +1138,9 @@ TALER_wallet_account_merge_verify ( struct GNUNET_TIME_Timestamp purse_expiration, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_Amount *amount, + const struct TALER_Amount *purse_fee, uint32_t min_age, + enum TALER_WalletAccountMergeFlags flags, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReserveSignatureP *reserve_sig) { @@ -1131,11 +1151,14 @@ TALER_wallet_account_merge_verify ( .purse_pub = *purse_pub, .purse_expiration = GNUNET_TIME_timestamp_hton (purse_expiration), .h_contract_terms = *h_contract_terms, - .min_age = htonl (min_age) + .min_age = htonl (min_age), + .flags = htonl ((uint32_t) flags) }; TALER_amount_hton (&pm.purse_amount, amount); + TALER_amount_hton (&pm.purse_fee, + purse_fee); return GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_WALLET_ACCOUNT_MERGE, &pm, -- cgit v1.2.3