[Webfunds-commits] java/webfunds/client/sox SOXWallet.java

Ian Grigg iang@cypherpunks.ai
Tue, 20 Jun 2000 17:06:51 -0400 (AST)


iang        00/06/20 17:06:51

  Modified:    webfunds/client/sox SOXWallet.java
  Log:
  added check to stop rewriting of payments with same pid, which breaks
  the payments data store....

Revision  Changes    Path
1.125     +20 -1     java/webfunds/client/sox/SOXWallet.java

Index: SOXWallet.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/SOXWallet.java,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- SOXWallet.java	2000/06/20 20:09:10	1.124
+++ SOXWallet.java	2000/06/20 21:06:50	1.125
@@ -1,4 +1,4 @@
-/* $Id: SOXWallet.java,v 1.124 2000/06/20 20:09:10 iang Exp $
+/* $Id: SOXWallet.java,v 1.125 2000/06/20 21:06:50 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -498,6 +498,25 @@
         src.setId(source.getId());
         long pend = getValue(src, contractid, true);
         long confirmed = getValue(src, contractid, false);
+
+        // it is an error (?) if the user asks for pid when
+        // that one is already in play.
+        if (pid != null && (pid.length() > 0))
+        {
+            StateReceipt sr;
+            try {
+                sr = receiptStore.getReceipt(src, contractid, pid);
+            } catch (StoreException ex) {
+                throw new webfunds.utils.Panic("get StateReceipt for " + pid);
+            }
+            if (sr != null)
+            {
+                error("pid exists already (cannot re-use): " + pid);
+                return null;
+            }
+        }
+
+
 
         if ( amount > 0 &&
            ((pend + confirmed) < amount || confirmed < amount))