summaryrefslogtreecommitdiff
path: root/src/util/amount.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-04 16:47:11 +0200
committerChristian Grothoff <christian@grothoff.org>2016-04-04 16:47:11 +0200
commit0ff76b5abbf09aa273b7998f4d16bb0c0e4d90bb (patch)
tree285f10a9026d5af1d763ab6a28c2f1b0db734974 /src/util/amount.c
parentbd6fb59e4ba0afd537563f356e6f1abf7b980666 (diff)
downloadexchange-0ff76b5abbf09aa273b7998f4d16bb0c0e4d90bb.tar.gz
exchange-0ff76b5abbf09aa273b7998f4d16bb0c0e4d90bb.tar.bz2
exchange-0ff76b5abbf09aa273b7998f4d16bb0c0e4d90bb.zip
fix test to ensure DB invariants are met
Diffstat (limited to 'src/util/amount.c')
-rw-r--r--src/util/amount.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util/amount.c b/src/util/amount.c
index dc2d2e400..4ac7d30ab 100644
--- a/src/util/amount.c
+++ b/src/util/amount.c
@@ -151,6 +151,30 @@ TALER_string_to_amount (const char *str,
/**
+ * Parse denomination description, in the format "T:V.F".
+ *
+ * @param str denomination description
+ * @param denom denomination to write the result to, in NBO
+ * @return #GNUNET_OK if the string is a valid denomination specification,
+ * #GNUNET_SYSERR if it is invalid.
+ */
+int
+TALER_string_to_amount_nbo (const char *str,
+ struct TALER_AmountNBO *denom)
+{
+ struct TALER_Amount amount;
+
+ if (GNUNET_OK !=
+ TALER_string_to_amount (str,
+ &amount))
+ return GNUNET_SYSERR;
+ TALER_amount_hton (denom,
+ &amount);
+ return GNUNET_OK;
+}
+
+
+/**
* Convert amount from host to network representation.
*
* @param res where to store amount in network representation