fix reserve_pub-via-reserve_priv FIXME
This commit is contained in:
parent
5a03bb71b5
commit
2ffabd394c
Binary file not shown.
@ -1 +1 @@
|
||||
EM5CX1EXCARDTQW260HE5YT55VH6BMF720K6CTJ3HP2YVAP4AQC0
|
||||
48X6TSXXCZ0F69A3Y12FPXMM1TBS4AVJ86EQ7GN9KMDZ7M0NFFCG
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -74,8 +74,7 @@ struct StatusState
|
||||
* @param history detailed transaction history, NULL on error.
|
||||
*/
|
||||
static void
|
||||
reserve_status_cb
|
||||
(void *cls,
|
||||
reserve_status_cb (void *cls,
|
||||
unsigned int http_status,
|
||||
enum TALER_ErrorCode ec,
|
||||
const json_t *json,
|
||||
@ -98,10 +97,12 @@ reserve_status_cb
|
||||
return;
|
||||
}
|
||||
|
||||
GNUNET_assert (GNUNET_OK == TALER_string_to_amount
|
||||
(ss->expected_balance, &eb));
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_string_to_amount (ss->expected_balance,
|
||||
&eb));
|
||||
|
||||
if (0 != TALER_amount_cmp (&eb, balance))
|
||||
if (0 != TALER_amount_cmp (&eb,
|
||||
balance))
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||
"Unexpected amount in reserve: %s\n",
|
||||
@ -111,10 +112,9 @@ reserve_status_cb
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixme: need a way to check if reserve history is consistent.
|
||||
* Every command which relates to reserve 'x' should be added in
|
||||
* a linked list of all commands that relate to the same reserve
|
||||
* 'x'.
|
||||
* FIXME: need a way to check if reserve history is consistent. Every
|
||||
* command which relates to reserve 'x' should be added in a linked list of
|
||||
* all commands that relate to the same reserve 'x'.
|
||||
*
|
||||
* API-wise, any command that relates to a reserve should offer a
|
||||
* method called e.g. "compare_with_history" that takes an element
|
||||
@ -126,7 +126,8 @@ reserve_status_cb
|
||||
* "reserve history update trait" which returns information about
|
||||
* how the command changes the history (provided only by commands
|
||||
* that change reserve balances)?
|
||||
*/TALER_TESTING_interpreter_next (ss->is);
|
||||
*///
|
||||
TALER_TESTING_interpreter_next (ss->is);
|
||||
}
|
||||
|
||||
|
||||
@ -144,16 +145,12 @@ status_run (void *cls,
|
||||
{
|
||||
struct StatusState *ss = cls;
|
||||
const struct TALER_TESTING_Command *create_reserve;
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv;
|
||||
struct TALER_ReservePublicKeyP reserve_pub;
|
||||
const struct TALER_ReservePublicKeyP *reserve_pubp;
|
||||
|
||||
ss->is = is;
|
||||
GNUNET_assert (NULL != ss->reserve_reference);
|
||||
|
||||
create_reserve
|
||||
= TALER_TESTING_interpreter_lookup_command
|
||||
(is, ss->reserve_reference);
|
||||
= TALER_TESTING_interpreter_lookup_command (is,
|
||||
ss->reserve_reference);
|
||||
|
||||
if (NULL == create_reserve)
|
||||
{
|
||||
@ -161,36 +158,16 @@ status_run (void *cls,
|
||||
TALER_TESTING_interpreter_fail (is);
|
||||
return;
|
||||
}
|
||||
|
||||
/* NOTE: the following line might generate a ERROR log
|
||||
* statements, but it can be ignored. */
|
||||
/* FIXME: instead of having this logic here, any
|
||||
command exporting a reserve_priv MUST also
|
||||
export a reserve_pub, which would obsolete this
|
||||
logic! */
|
||||
if (GNUNET_OK ==
|
||||
TALER_TESTING_get_trait_reserve_priv (create_reserve,
|
||||
0,
|
||||
&reserve_priv))
|
||||
{
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
|
||||
&reserve_pub.eddsa_pub);
|
||||
reserve_pubp = &reserve_pub;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GNUNET_OK !=
|
||||
TALER_TESTING_get_trait_reserve_pub (create_reserve,
|
||||
0,
|
||||
&reserve_pubp))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_LOG_ERROR ("The reserve has neither a priv nor a pub.\n");
|
||||
TALER_LOG_ERROR ("Failed to find reserve_pub for status query\n");
|
||||
TALER_TESTING_interpreter_fail (is);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ss->rsh = TALER_EXCHANGE_reserve_status (is->exchange,
|
||||
reserve_pubp,
|
||||
&reserve_status_cb,
|
||||
@ -242,11 +219,12 @@ TALER_TESTING_cmd_status (const char *label,
|
||||
{
|
||||
struct StatusState *ss;
|
||||
|
||||
GNUNET_assert (NULL != reserve_reference);
|
||||
ss = GNUNET_new (struct StatusState);
|
||||
ss->reserve_reference = reserve_reference;
|
||||
ss->expected_balance = expected_balance;
|
||||
ss->expected_response_code = expected_response_code;
|
||||
|
||||
{
|
||||
struct TALER_TESTING_Command cmd = {
|
||||
.cls = ss,
|
||||
.label = label,
|
||||
@ -256,3 +234,4 @@ TALER_TESTING_cmd_status (const char *label,
|
||||
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
@ -350,6 +350,7 @@ withdraw_traits (void *cls,
|
||||
struct WithdrawState *ws = cls;
|
||||
const struct TALER_TESTING_Command *reserve_cmd;
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv;
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub;
|
||||
|
||||
/* We offer the reserve key where these coins were withdrawn
|
||||
* from. */
|
||||
@ -372,6 +373,15 @@ withdraw_traits (void *cls,
|
||||
TALER_TESTING_interpreter_fail (ws->is);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
TALER_TESTING_get_trait_reserve_pub (reserve_cmd,
|
||||
0,
|
||||
&reserve_pub))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_TESTING_interpreter_fail (ws->is);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (NULL == ws->exchange_url)
|
||||
ws->exchange_url
|
||||
= GNUNET_strdup (TALER_EXCHANGE_get_base_url (ws->is->exchange));
|
||||
@ -387,6 +397,8 @@ withdraw_traits (void *cls,
|
||||
&ws->sig),
|
||||
TALER_TESTING_make_trait_reserve_priv (0,
|
||||
reserve_priv),
|
||||
TALER_TESTING_make_trait_reserve_pub (0,
|
||||
reserve_pub),
|
||||
TALER_TESTING_make_trait_amount_obj (0,
|
||||
&ws->amount),
|
||||
TALER_TESTING_make_trait_url (0, ws->exchange_url),
|
||||
|
Loading…
Reference in New Issue
Block a user