getting banking details through config file in benchmark
This commit is contained in:
parent
46c593f93e
commit
feb60291b6
1
src/benchmark/merchant_details.json
Normal file
1
src/benchmark/merchant_details.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"type":"test", "bank_uri":"https://bank.test.taler.net/", "account_number":63}
|
1
src/benchmark/sender_details.json
Normal file
1
src/benchmark/sender_details.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"type":"test", "bank_uri":"https://bank.test.taler.net/", "account_number":63}
|
@ -26,6 +26,7 @@
|
|||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include <gnunet/gnunet_curl_lib.h>
|
#include <gnunet/gnunet_curl_lib.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
|
#include <jansson.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How many coins the benchmark should operate on
|
* How many coins the benchmark should operate on
|
||||||
@ -47,6 +48,16 @@ struct GNUNET_CONFIGURATION_Handle *cfg;
|
|||||||
*/
|
*/
|
||||||
static unsigned int nreserves;
|
static unsigned int nreserves;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bank details of who creates reserves
|
||||||
|
*/
|
||||||
|
json_t *sender_details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bank details of who deposits coins
|
||||||
|
*/
|
||||||
|
json_t *merchant_details;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needed information for a reserve. Other values are the same for all reserves, therefore defined in global variables
|
* Needed information for a reserve. Other values are the same for all reserves, therefore defined in global variables
|
||||||
*/
|
*/
|
||||||
@ -387,7 +398,6 @@ reserve_withdraw_cb (void *cls,
|
|||||||
struct GNUNET_TIME_Absolute timestamp;
|
struct GNUNET_TIME_Absolute timestamp;
|
||||||
struct GNUNET_TIME_Absolute refund_deadline;
|
struct GNUNET_TIME_Absolute refund_deadline;
|
||||||
struct GNUNET_HashCode h_contract;
|
struct GNUNET_HashCode h_contract;
|
||||||
json_t *merchant_details;
|
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
struct TALER_DepositRequestPS dr;
|
struct TALER_DepositRequestPS dr;
|
||||||
struct TALER_MerchantPublicKeyP merchant_pub;
|
struct TALER_MerchantPublicKeyP merchant_pub;
|
||||||
@ -408,10 +418,6 @@ reserve_withdraw_cb (void *cls,
|
|||||||
TALER_amount_subtract (&amount,
|
TALER_amount_subtract (&amount,
|
||||||
&coins[coin_index].pk->value,
|
&coins[coin_index].pk->value,
|
||||||
&coins[coin_index].pk->fee_deposit);
|
&coins[coin_index].pk->fee_deposit);
|
||||||
merchant_details = json_loads ("{ \"type\":\"test\", \"bank_uri\":\"https://bank.test.taler.net/\", \"account_number\":63}",
|
|
||||||
JSON_REJECT_DUPLICATES,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
memset (&dr, 0, sizeof (dr));
|
memset (&dr, 0, sizeof (dr));
|
||||||
dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
|
dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
|
||||||
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
|
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
|
||||||
@ -523,7 +529,6 @@ benchmark_run (void *cls)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
|
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
|
||||||
json_t *transfer_details;
|
json_t *transfer_details;
|
||||||
json_t *sender_details;
|
|
||||||
char *uuid;
|
char *uuid;
|
||||||
struct TALER_ReservePublicKeyP reserve_pub;
|
struct TALER_ReservePublicKeyP reserve_pub;
|
||||||
struct GNUNET_TIME_Absolute execution_date;
|
struct GNUNET_TIME_Absolute execution_date;
|
||||||
@ -538,9 +543,6 @@ benchmark_run (void *cls)
|
|||||||
sizeof (blinding_key));
|
sizeof (blinding_key));
|
||||||
TALER_amount_get_zero (currency, &reserve_amount);
|
TALER_amount_get_zero (currency, &reserve_amount);
|
||||||
reserve_amount.value = RESERVE_VALUE;
|
reserve_amount.value = RESERVE_VALUE;
|
||||||
sender_details = json_loads ("{ \"type\":\"test\", \"bank_uri\":\"https://bank.test.taler.net/\", \"account_number\":62}",
|
|
||||||
JSON_REJECT_DUPLICATES,
|
|
||||||
NULL);
|
|
||||||
execution_date = GNUNET_TIME_absolute_get ();
|
execution_date = GNUNET_TIME_absolute_get ();
|
||||||
GNUNET_TIME_round_abs (&execution_date);
|
GNUNET_TIME_round_abs (&execution_date);
|
||||||
|
|
||||||
@ -708,7 +710,8 @@ do_shutdown (void *cls)
|
|||||||
static void
|
static void
|
||||||
run (void *cls)
|
run (void *cls)
|
||||||
{
|
{
|
||||||
|
char *sender_details_filename;
|
||||||
|
char *merchant_details_filename;
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"running run()\n");
|
"running run()\n");
|
||||||
@ -722,17 +725,36 @@ run (void *cls)
|
|||||||
fail ("-c option is mandatory\n");
|
fail ("-c option is mandatory\n");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read BANK_URI in here
|
* Read sender_details.json here
|
||||||
*/
|
*/
|
||||||
cfg = GNUNET_CONFIGURATION_create ();
|
cfg = GNUNET_CONFIGURATION_create ();
|
||||||
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (cfg, config_file))
|
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_parse (cfg, config_file))
|
||||||
fail ("failed to parse configuration file\n");
|
fail ("failed to parse configuration file\n");
|
||||||
|
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg,
|
||||||
|
"benchmark",
|
||||||
|
"sender_details",
|
||||||
|
&sender_details_filename))
|
||||||
|
fail ("failed to get SENDER_DETAILS value\n");
|
||||||
|
|
||||||
|
sender_details = json_load_file (sender_details_filename,
|
||||||
|
JSON_REJECT_DUPLICATES,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg,
|
||||||
|
"benchmark",
|
||||||
|
"merchant_details",
|
||||||
|
&merchant_details_filename))
|
||||||
|
fail ("failed to get MERCHANT_DETAILS value\n");
|
||||||
|
|
||||||
|
merchant_details = json_load_file (merchant_details_filename,
|
||||||
|
JSON_REJECT_DUPLICATES,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
GNUNET_array_append (spent_coins,
|
GNUNET_array_append (spent_coins,
|
||||||
spent_coins_size,
|
spent_coins_size,
|
||||||
1);
|
1);
|
||||||
spent_coins_size++;
|
spent_coins_size++;
|
||||||
|
|
||||||
reserves = NULL;
|
reserves = NULL;
|
||||||
coins = NULL;
|
coins = NULL;
|
||||||
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
|
ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
[benchmark]
|
[benchmark]
|
||||||
BANK_URI = https://bank.test.taler.net/
|
SENDER_DETAILS = ~/exchange/src/benchmark/sender_details.json
|
||||||
|
MERCHANT_DETAILS = ~/exchange/src/benchmark/merchant_details.json
|
||||||
|
Loading…
Reference in New Issue
Block a user