diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-22 15:42:21 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-22 15:42:21 +0100 |
commit | 5f35f8cac34bbdfe31b950a0c706ed2737828006 (patch) | |
tree | 56993f02500e91b58320e57b59ec93de041d7fec | |
parent | 3a8a5ca77755048f105212d0a0c9453b3d0e1037 (diff) | |
download | merchant-5f35f8cac34bbdfe31b950a0c706ed2737828006.tar.gz merchant-5f35f8cac34bbdfe31b950a0c706ed2737828006.tar.bz2 merchant-5f35f8cac34bbdfe31b950a0c706ed2737828006.zip |
Produce random order_id.
-rw-r--r-- | src/samples/generate_payments.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/samples/generate_payments.c b/src/samples/generate_payments.c index 515953f2..4bf3a78f 100644 --- a/src/samples/generate_payments.c +++ b/src/samples/generate_payments.c @@ -770,11 +770,6 @@ interpreter_run (void *cls) j++; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "j=%d, times=%d\n", - j, - times); - if (j < times) { is->ip = 0; @@ -1329,6 +1324,7 @@ make_order (char *currency, struct TALER_Amount tmp_amount; json_t *tmp_total; json_t *tmp_maxfee; + unsigned long long id; GNUNET_asprintf (&tmp_str, "%s:%s", @@ -1346,9 +1342,12 @@ make_order (char *currency, TALER_string_to_amount (tmp_str, &tmp_amount); tmp_maxfee = TALER_JSON_from_amount (&tmp_amount); + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, + &id, + sizeof (id)); GNUNET_asprintf (&ret, "{\ \"max_fee\":%s,\ - \"order_id\":\"1\",\ + \"order_id\":\"%s\",\ \"timestamp\":\"\\/Date(42)\\/\",\ \"refund_deadline\":\"\\/Date(0)\\/\",\ \"pay_deadline\":\"\\/Date(9999999999)\\/\",\ @@ -1357,6 +1356,7 @@ make_order (char *currency, \"products\":\ [ {\"description\":\"ice cream\"} ] }", json_dumps (tmp_maxfee, JSON_COMPACT), + TALER_b2s (&id, sizeof (id)), json_dumps (tmp_total, JSON_COMPACT)); GNUNET_free (tmp_str); |