diff options
author | Florian Dold <florian@dold.me> | 2024-11-11 14:36:08 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-11-11 14:36:08 +0100 |
commit | 6bdf1bc968124a32c932b75579ab6078ea6898cc (patch) | |
tree | d13bcf58bf38ba827d47b8660aca57d7cef848a9 | |
parent | 689589e325d288ef6447bbc749b05bfa95ea7116 (diff) |
tolerate automated aml outcomes with same decision timestamp
-rw-r--r-- | src/exchange/taler-exchange-httpd_common_kyc.c | 14 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-info.c | 15 | ||||
-rw-r--r-- | src/exchangedb/exchange_do_insert_aml_decision.sql | 2 | ||||
-rw-r--r-- | src/exchangedb/exchange_do_insert_successor_measure.sql | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_lookup_aml_history.c | 2 | ||||
-rw-r--r-- | src/exchangedb/pg_lookup_rules_by_access_token.c | 3 |
6 files changed, 15 insertions, 23 deletions
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c index d5766e5ba..b8b48077e 100644 --- a/src/exchange/taler-exchange-httpd_common_kyc.c +++ b/src/exchange/taler-exchange-httpd_common_kyc.c @@ -1643,15 +1643,11 @@ legitimization_check_run ( NULL); goto cleanup; } - if (GNUNET_TIME_timestamp_cmp (last_date, - >=, - decision_time)) - { - legi_fail (lch, - TALER_EC_EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT, - "later decision exists"); - goto cleanup; - } + /* We tolerate conflicting decision times for automatic decisions. */ + GNUNET_break ( + GNUNET_TIME_timestamp_cmp (last_date, + >=, + decision_time)); /* Back to default rules. */ TALER_KYCLOGIC_rules_free (lrs); lrs = NULL; diff --git a/src/exchange/taler-exchange-httpd_kyc-info.c b/src/exchange/taler-exchange-httpd_kyc-info.c index e5eb8d3a9..ab0afe089 100644 --- a/src/exchange/taler-exchange-httpd_kyc-info.c +++ b/src/exchange/taler-exchange-httpd_kyc-info.c @@ -719,16 +719,11 @@ TEH_handler_kyc_info ( NULL); goto cleanup; } - if (GNUNET_TIME_timestamp_cmp (last_date, - >=, - decision_time)) - { - res = TALER_MHD_reply_with_ec ( - rc->connection, - TALER_EC_EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT, - "later decision exists"); - goto cleanup; - } + /* We tolerate conflicting decision times for automatic decisions. */ + GNUNET_break ( + GNUNET_TIME_timestamp_cmp (last_date, + >=, + decision_time)); /* Back to default rules. */ TALER_KYCLOGIC_rules_free (lrs); lrs = NULL; diff --git a/src/exchangedb/exchange_do_insert_aml_decision.sql b/src/exchangedb/exchange_do_insert_aml_decision.sql index b84127071..dec1c3ab9 100644 --- a/src/exchangedb/exchange_do_insert_aml_decision.sql +++ b/src/exchangedb/exchange_do_insert_aml_decision.sql @@ -64,7 +64,7 @@ SELECT decision_time FROM legitimization_outcomes WHERE h_payto=in_h_normalized_payto AND is_active - ORDER BY decision_time DESC; + ORDER BY decision_time DESC, outcome_serial_id DESC; IF FOUND THEN diff --git a/src/exchangedb/exchange_do_insert_successor_measure.sql b/src/exchangedb/exchange_do_insert_successor_measure.sql index 591976695..60895cef2 100644 --- a/src/exchangedb/exchange_do_insert_successor_measure.sql +++ b/src/exchangedb/exchange_do_insert_successor_measure.sql @@ -41,7 +41,7 @@ SELECT decision_time FROM legitimization_outcomes WHERE h_payto=in_h_normalized_payto AND is_active - ORDER BY decision_time DESC; + ORDER BY decision_time DESC, outcome_serial_id DESC; IF FOUND THEN diff --git a/src/exchangedb/pg_lookup_aml_history.c b/src/exchangedb/pg_lookup_aml_history.c index 77ab92dff..da7c153ca 100644 --- a/src/exchangedb/pg_lookup_aml_history.c +++ b/src/exchangedb/pg_lookup_aml_history.c @@ -154,7 +154,7 @@ TEH_PG_lookup_aml_history ( " JOIN legitimization_outcomes lo" " USING (outcome_serial_id)" " WHERE ah.h_payto=$1" - " ORDER BY decision_time DESC;"); + " ORDER BY decision_time DESC, outcome_serial_id DESC;"); qs = GNUNET_PQ_eval_prepared_multi_select ( pg->conn, "lookup_aml_history", diff --git a/src/exchangedb/pg_lookup_rules_by_access_token.c b/src/exchangedb/pg_lookup_rules_by_access_token.c index cf7cec0cd..59899e256 100644 --- a/src/exchangedb/pg_lookup_rules_by_access_token.c +++ b/src/exchangedb/pg_lookup_rules_by_access_token.c @@ -59,7 +59,8 @@ TEH_PG_lookup_rules_by_access_token ( " WHERE h_payto=$1" " AND expiration_time>$2" " AND is_active" - " ORDER BY expiration_time DESC" + " ORDER BY expiration_time DESC," + " outcome_serial_id DESC" " LIMIT 1;"); now = GNUNET_TIME_absolute_get (); return GNUNET_PQ_eval_prepared_singleton_select ( |