diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index 7cf505f..6b52d25 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -523,9 +523,16 @@ upsertPayment pipe dbName p = do (memo p) let payment = val payTx case payment of - Doc d -> - access pipe master dbName $ - upsert (select ["txid" =: txid p] "payments") d + Doc d -> do + results <- + access + pipe + master + dbName + (rest =<< find (select ["txid" =: txid p] "payments")) + when (null results) $ + access pipe master dbName $ + upsert (select ["txid" =: txid p] "payments") d _ -> return () authSettings :: AuthSettings