aboutsummaryrefslogtreecommitdiff
path: root/src/util/wallet_signatures.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-05-08 11:37:37 +0200
committerChristian Grothoff <christian@grothoff.org>2022-05-08 11:37:37 +0200
commitd3a63881999aa1c6d763263346a0a5979ec6efac (patch)
tree92f220ad08ce79d1f18366346ffabfa93cf33d75 /src/util/wallet_signatures.c
parent6b8e732bf8d8bfae268e7f5a9a09af9167fd0d47 (diff)
downloadexchange-d3a63881999aa1c6d763263346a0a5979ec6efac.tar.xz
pass purse_fee to determine how purse creation is paid for
Diffstat (limited to 'src/util/wallet_signatures.c')
-rw-r--r--src/util/wallet_signatures.c29
1 files changed, 26 insertions, 3 deletions
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
@@ -1063,6 +1063,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.
*/
struct TALER_PrivateContractHashP h_contract_terms;
@@ -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,