summaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_ensure_coin_known.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-12-13 14:33:23 +0100
committerÖzgür Kesim <oec-taler@kesim.org>2023-12-13 14:33:23 +0100
commit227dc29fcd78f0cd6b394ff2716c548f9be2adb6 (patch)
treece8a2ab1513b940ae3aa9fd368adcc9c321231be /src/exchangedb/pg_ensure_coin_known.c
parentd3ed984b0ffa6e0ffad4193f4e881db53ac75565 (diff)
downloadexchange-227dc29fcd78f0cd6b394ff2716c548f9be2adb6.tar.gz
exchange-227dc29fcd78f0cd6b394ff2716c548f9be2adb6.tar.bz2
exchange-227dc29fcd78f0cd6b394ff2716c548f9be2adb6.zip
[wip, #7267] more refined age commitment conflict response during deposit
Distinguish between and communicate: a) null hash value expected, got non-null b) non-null hash value expected, got null c) hash value of known coin differ from given
Diffstat (limited to 'src/exchangedb/pg_ensure_coin_known.c')
-rw-r--r--src/exchangedb/pg_ensure_coin_known.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/exchangedb/pg_ensure_coin_known.c b/src/exchangedb/pg_ensure_coin_known.c
index 952acf24f..307b8df52 100644
--- a/src/exchangedb/pg_ensure_coin_known.c
+++ b/src/exchangedb/pg_ensure_coin_known.c
@@ -21,6 +21,7 @@
#include "platform.h"
#include "taler_error_codes.h"
#include "taler_dbevents.h"
+#include "taler_exchangedb_plugin.h"
#include "taler_pq_lib.h"
#include "pg_ensure_coin_known.h"
#include "pg_helper.h"
@@ -143,13 +144,25 @@ TEH_PG_ensure_coin_known (void *cls,
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT;
}
- if ( (! is_age_hash_null) &&
- (0 != GNUNET_memcmp (h_age_commitment,
- &coin->h_age_commitment)) )
+ if (is_age_hash_null != coin->no_age_commitment)
+ {
+ if (is_age_hash_null)
+ {
+ GNUNET_break_op (0);
+ return TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NULL;
+ }
+ else
+ {
+ GNUNET_break_op (0);
+ return TALER_EXCHANGEDB_CKS_AGE_CONFLICT_EXPECTED_NON_NULL;
+ }
+ }
+ else if ( (! is_age_hash_null) &&
+ (0 != GNUNET_memcmp (h_age_commitment,
+ &coin->h_age_commitment)) )
{
- GNUNET_break (GNUNET_is_zero (h_age_commitment));
GNUNET_break_op (0);
- return TALER_EXCHANGEDB_CKS_AGE_CONFLICT;
+ return TALER_EXCHANGEDB_CKS_AGE_CONFLICT_VALUE_DIFFERS;
}
return TALER_EXCHANGEDB_CKS_PRESENT;