implementing #3740
This commit is contained in:
parent
929a99cdbb
commit
bd2372f20e
@ -1,6 +1,12 @@
|
|||||||
[mint]
|
[mint]
|
||||||
db = postgres:///taler
|
# Currency supported by the mint (can only be one)
|
||||||
port = 4241
|
CURRENCY = EUR
|
||||||
TMH_master_public_key = ...
|
|
||||||
refresh_security_parameter = 3
|
|
||||||
|
|
||||||
|
# How to access our database
|
||||||
|
DB = postgres:///taler
|
||||||
|
|
||||||
|
# HTTP port the mint listens to
|
||||||
|
PORT = 4241
|
||||||
|
|
||||||
|
# Master public key used to sign the mint's various keys
|
||||||
|
TMH_MASTER_PUBLIC_KEY = ...
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
#include "taler-mint-httpd_keystate.h"
|
#include "taler-mint-httpd_keystate.h"
|
||||||
#include "taler_mintdb_plugin.h"
|
#include "taler_mintdb_plugin.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which currency is used by this mint?
|
||||||
|
*/
|
||||||
|
char *TMH_mint_currency_string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base directory of the mint (global)
|
* Base directory of the mint (global)
|
||||||
@ -248,9 +252,27 @@ mint_serve_process_config (const char *mint_directory)
|
|||||||
if (NULL == cfg)
|
if (NULL == cfg)
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"can't load mint configuration\n");
|
"Failed to load mint configuration\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
||||||
|
"mint",
|
||||||
|
"currency",
|
||||||
|
&TMH_mint_currency_string))
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"No currency given in mint configuration.");
|
||||||
|
return GNUNET_NO;
|
||||||
|
}
|
||||||
|
if (strlen (TMH_mint_currency_string) >= TALER_CURRENCY_LEN)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"Currency `%s' longer than the allowed limit of %u characters.",
|
||||||
|
TMH_mint_currency_string,
|
||||||
|
(unsigned int) TALER_CURRENCY_LEN);
|
||||||
|
return GNUNET_NO;
|
||||||
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_get_value_string (cfg,
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
||||||
"mint",
|
"mint",
|
||||||
|
@ -28,10 +28,9 @@
|
|||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For now, we just do EUR. Should become configurable in the future! (#3740)
|
* Which currency is used by this mint?
|
||||||
*/
|
*/
|
||||||
#define TMH_MINT_CURRENCY "EUR"
|
extern char *TMH_mint_currency_string;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mint's configuration.
|
* The mint's configuration.
|
||||||
|
@ -1025,7 +1025,7 @@ TMH_PARSE_amount_json (struct MHD_Connection *connection,
|
|||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
}
|
}
|
||||||
if (0 != strcmp (currency,
|
if (0 != strcmp (currency,
|
||||||
TMH_MINT_CURRENCY))
|
TMH_mint_currency_string))
|
||||||
{
|
{
|
||||||
TALER_LOG_WARNING ("Currency specified not supported by this mint\n");
|
TALER_LOG_WARNING ("Currency specified not supported by this mint\n");
|
||||||
if (MHD_YES !=
|
if (MHD_YES !=
|
||||||
@ -1039,8 +1039,8 @@ TMH_PARSE_amount_json (struct MHD_Connection *connection,
|
|||||||
}
|
}
|
||||||
amount->value = (uint64_t) value;
|
amount->value = (uint64_t) value;
|
||||||
amount->fraction = (uint32_t) fraction;
|
amount->fraction = (uint32_t) fraction;
|
||||||
GNUNET_assert (strlen (TMH_MINT_CURRENCY) < TALER_CURRENCY_LEN);
|
GNUNET_assert (strlen (TMH_mint_currency_string) < TALER_CURRENCY_LEN);
|
||||||
strcpy (amount->currency, TMH_MINT_CURRENCY);
|
strcpy (amount->currency, TMH_mint_currency_string);
|
||||||
TALER_amount_normalize (amount);
|
TALER_amount_normalize (amount);
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
|
|||||||
struct TALER_Amount total_melt;
|
struct TALER_Amount total_melt;
|
||||||
|
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_get_zero (TMH_MINT_CURRENCY,
|
TALER_amount_get_zero (TMH_mint_currency_string,
|
||||||
&total_cost));
|
&total_cost));
|
||||||
key_state = TMH_KS_acquire ();
|
key_state = TMH_KS_acquire ();
|
||||||
for (i=0;i<num_new_denoms;i++)
|
for (i=0;i<num_new_denoms;i++)
|
||||||
@ -102,7 +102,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_get_zero (TMH_MINT_CURRENCY,
|
TALER_amount_get_zero (TMH_mint_currency_string,
|
||||||
&total_melt));
|
&total_melt));
|
||||||
for (i=0;i<coin_count;i++)
|
for (i=0;i<coin_count;i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user