diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-08-25 19:52:53 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-08-25 19:52:53 +0200 |
commit | ecae3c26dd054f8c17e335622036a1e38a48ed9a (patch) | |
tree | 702287797c2eae66f23b38c293f5c04027cf85ac /src/bank-lib/taler-fakebank-run.c | |
parent | 83225275361a92390f92245e0edb04e1c675dc91 (diff) | |
download | exchange-ecae3c26dd054f8c17e335622036a1e38a48ed9a.tar.xz |
-enable signup bonus with fakebank
Diffstat (limited to 'src/bank-lib/taler-fakebank-run.c')
-rw-r--r-- | src/bank-lib/taler-fakebank-run.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/bank-lib/taler-fakebank-run.c b/src/bank-lib/taler-fakebank-run.c index d77d6b3d5..c15145ecb 100644 --- a/src/bank-lib/taler-fakebank-run.c +++ b/src/bank-lib/taler-fakebank-run.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2016, 2017 Taler Systems SA + Copyright (C) 2016-2022 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -52,6 +52,10 @@ static struct TALER_FAKEBANK_Handle *fb; */ static struct GNUNET_SCHEDULER_Task *keepalive; +/** + * Amount to credit an account with on /register. + */ +static struct TALER_Amount signup_bonus; /** * Stop the process. @@ -161,12 +165,28 @@ run (void *cls, go |= TALER_MHD_GO_FORCE_CONNECTION_CLOSE; TALER_MHD_setup (go); } + if (GNUNET_OK != + TALER_amount_is_valid (&signup_bonus)) + { + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (currency_string, + &signup_bonus)); + } + if (0 != strcmp (currency_string, + signup_bonus.currency)) + { + fprintf (stderr, + "Signup bonus and main currency do not match\n"); + ret = EXIT_INVALIDARGUMENT; + return; + } fb = TALER_FAKEBANK_start3 (hostname, (uint16_t) port, exchange_url, currency_string, ram, - num_threads); + num_threads, + &signup_bonus); GNUNET_free (hostname); GNUNET_free (exchange_url); GNUNET_free (currency_string); @@ -206,6 +226,11 @@ main (int argc, "NUM_THREADS", "size of the thread pool", &num_threads), + TALER_getopt_get_amount ('s', + "signup-bonus", + "AMOUNT", + "amount to credit newly registered account (created out of thin air)", + &signup_bonus), GNUNET_GETOPT_OPTION_END }; enum GNUNET_GenericReturnValue iret; |