commit f2dd37b689d4be76562013be7ee12e57fc736fd0
parent 9e9c7832ea881fbb943087eba71e2f49d673dad3
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sat, 18 Jul 2026 00:39:55 +0200
add sanity check
Diffstat:
6 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/donau/donau-httpd_post-batch-submit.c b/src/donau/donau-httpd_post-batch-submit.c
@@ -260,6 +260,8 @@ DH_handler_post_batch_submit (struct DH_RequestContext *rc,
"insert_submitted_receipts");
}
}
+ /* Note: we do not care here about conflicts on insert,
+ as conflicts only happen for idempotent requests. */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"submitted receipts inserted!\n");
diff --git a/src/donaudb/insert_submitted_receipts.c b/src/donaudb/insert_submitted_receipts.c
@@ -29,12 +29,12 @@
enum GNUNET_DB_QueryStatus
-DONAUDB_insert_submitted_receipts (struct DONAUDB_PostgresContext *ctx,
- struct DONAU_HashDonorTaxId *h_donor_tax_id,
- size_t num_dr,
- const struct DONAU_DonationReceipt
- donation_receipts[static num_dr],
- uint64_t donation_year)
+DONAUDB_insert_submitted_receipts (
+ struct DONAUDB_PostgresContext *ctx,
+ struct DONAU_HashDonorTaxId *h_donor_tax_id,
+ size_t num_dr,
+ const struct DONAU_DonationReceipt donation_receipts[static num_dr],
+ uint64_t donation_year)
{
struct GNUNET_HashCode h_donation_unit_pubs[GNUNET_NZL (num_dr)];
struct DONAU_UniqueDonorIdentifierNonce nonces[GNUNET_NZL (num_dr)];
diff --git a/src/donaudb/iterate_submitted_receipts.c b/src/donaudb/iterate_submitted_receipts.c
@@ -71,6 +71,8 @@ DONAUDB_iterate_submitted_receipts (
total_donations);
total_donations->value = valueSum;
total_donations->fraction = fractionSum;
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_is_valid (total_donations));
if (TALER_amount_is_zero (total_donations))
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
return qs;
diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h
@@ -375,7 +375,7 @@ struct DONAU_DonationStatement
/**
* The corresponding year.
*/
- uint64_t year;
+ uint32_t year;
/**
* The salted and hashed donor id.
@@ -501,7 +501,7 @@ enum TALER_ErrorCode
DONAU_donation_statement_sign (
DONAU_DonauSignCallback scb,
const struct TALER_Amount *amount_tot,
- const uint64_t year,
+ uint32_t year,
const struct DONAU_HashDonorTaxId *i,
struct DONAU_DonauPublicKeyP *donau_pub,
struct DONAU_DonauSignatureP *donau_sig);
@@ -520,7 +520,7 @@ DONAU_donation_statement_sign (
enum GNUNET_GenericReturnValue
DONAU_donation_statement_verify (
const struct TALER_Amount *amount_tot,
- const uint64_t year,
+ uint32_t year,
const struct DONAU_HashDonorTaxId *i,
const struct DONAU_DonauPublicKeyP *donau_pub,
const struct DONAU_DonauSignatureP *statement_sig);
diff --git a/src/include/donaudb_lib.h b/src/include/donaudb_lib.h
@@ -136,10 +136,11 @@ struct DONAUDB_IssuedReceiptsMetaData
struct DONAUDB_DonationUnitKey
{
/**
- * The private key of the donation unit. Will be NULL if the private
+ * The private key of the donation unit.
+ * Will contain a NULL if the private
* key is not available.
*/
- struct DONAU_DonationUnitPublicKey donation_unit_priv;
+ struct DONAU_DonationUnitPrivateKey donation_unit_priv;
/**
* Decoded donation unit public key.
diff --git a/src/util/donau_signatures.c b/src/util/donau_signatures.c
@@ -63,7 +63,7 @@ enum TALER_ErrorCode
DONAU_donation_statement_sign (
DONAU_DonauSignCallback scb,
const struct TALER_Amount *amount_tot,
- const uint64_t year,
+ uint32_t year,
const struct DONAU_HashDonorTaxId *i,
struct DONAU_DonauPublicKeyP *donau_pub,
struct DONAU_DonauSignatureP *donau_sig)
@@ -87,7 +87,7 @@ DONAU_donation_statement_sign (
enum GNUNET_GenericReturnValue
DONAU_donation_statement_verify (
const struct TALER_Amount *amount_tot,
- const uint64_t year,
+ uint32_t year,
const struct DONAU_HashDonorTaxId *i,
const struct DONAU_DonauPublicKeyP *donau_pub,
const struct DONAU_DonauSignatureP *statement_sig)