gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: bounce duplicate reserves


From: gnunet
Subject: [libeufin] branch master updated: bounce duplicate reserves
Date: Tue, 12 Jul 2022 11:07:27 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new e59182e5 bounce duplicate reserves
e59182e5 is described below

commit e59182e54d31b7bcbf5042c796facb7d361a06b4
Author: MS <ms@taler.net>
AuthorDate: Tue Jul 12 11:07:19 2022 +0200

    bounce duplicate reserves
---
 nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt |  1 -
 nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt      | 17 ++++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt
index c2e5b2f7..2c2a3ea1 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt
@@ -80,7 +80,6 @@ fun ingestFacadeTransactions(
             lastId = it.id.value
         }
         try {
-            // FIXME: This currently does not do proper error handing.
             if (refundCb != null) {
                 refundCb(bankAccount, facadeState.highestSeenMessageSerialId)
             }
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index e4ac0209..97434bb8 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -241,6 +241,7 @@ private suspend fun talerTransfer(call: ApplicationCall) {
 }
 
 fun talerFilter(payment: NexusBankTransactionEntity, txDtls: 
TransactionDetails) {
+    var isInvalid = false // True when pub is invalid or duplicate.
     val subject = txDtls.unstructuredRemittanceInformation
     val debtorName = txDtls.debtor?.name
     if (debtorName == null) {
@@ -276,24 +277,30 @@ fun talerFilter(payment: NexusBankTransactionEntity, 
txDtls: TransactionDetails)
             this.payment = payment
             timestampMs = System.currentTimeMillis()
         }
-        // FIXME: send back!
+        // Will be paid back by the refund handler.
         return
     }
     // Check if reserve_pub was used already
     val maybeExist = TalerIncomingPaymentEntity.find {
         TalerIncomingPaymentsTable.reservePublicKey eq reservePub
     }.firstOrNull()
-    if (maybeExist != null) throw conflict("Reserve pub '$reservePub' was used 
already")
+    if (maybeExist != null) {
+        val msg = "Reserve pub '$reservePub' was used already"
+        logger.info(msg)
+        isInvalid = true
+    }
 
     if (!CryptoUtil.checkValidEddsaPublicKey(reservePub)) {
         // FIXME: send back!
-        logger.warn("invalid public key")
+        logger.info("invalid public key detected")
+        isInvalid = true
+    }
+    if (isInvalid) {
         TalerInvalidIncomingPaymentEntity.new {
             this.payment = payment
             timestampMs = System.currentTimeMillis()
         }
-        logger.warn("Invalid public key found")
-        // FIXME: send back!
+        // Will be paid back by the refund handler.
         return
     }
     TalerIncomingPaymentEntity.new {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]