From 0ff76b5abbf09aa273b7998f4d16bb0c0e4d90bb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 4 Apr 2016 16:47:11 +0200 Subject: fix test to ensure DB invariants are met --- src/util/amount.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/util/amount.c') 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 @@ -150,6 +150,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. * -- cgit v1.2.3