diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-08-09 16:34:40 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-08-09 16:34:40 +0200 |
commit | 94b0b28994b4f4563bd0b8e309f96ed14ca9f7c0 (patch) | |
tree | e3b116c39994f8661cc6da87fcf83bf1a7adc286 /src/mint-lib | |
parent | f545cd0c4167a7431f21215788e03e80ae9a4d9f (diff) |
add checks for /refresh/link result
Diffstat (limited to 'src/mint-lib')
-rw-r--r-- | src/mint-lib/test_mint_api.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/mint-lib/test_mint_api.c b/src/mint-lib/test_mint_api.c index c36221d69..e6ffbc7fb 100644 --- a/src/mint-lib/test_mint_api.c +++ b/src/mint-lib/test_mint_api.c @@ -21,7 +21,6 @@ * * TODO: * - test /refresh/-operations - * - check coins returned by link_cb */ #include "platform.h" #include "taler_util.h" @@ -981,6 +980,8 @@ link_cb (void *cls, { struct InterpreterState *is = cls; struct Command *cmd = &is->commands[is->ip]; + const struct Command *ref; + unsigned int i; cmd->details.refresh_link.rlh = NULL; if (cmd->expected_response_code != http_status) @@ -992,10 +993,37 @@ link_cb (void *cls, fail (is); return; } + ref = find_command (is, + cmd->details.refresh_link.reveal_ref); switch (http_status) { case MHD_HTTP_OK: - // FIXME: test returned values... + /* check that number of coins returned matches */ + if (num_coins != ref->details.refresh_reveal.num_fresh_coins) + { + GNUNET_break (0); + fail (is); + return; + } + /* check that the coins match */ + for (i=0;i<num_coins;i++) + { + const struct FreshCoin *fc; + + fc = &ref->details.refresh_reveal.fresh_coins[i]; + if ( (0 != memcmp (&coin_privs[i], + &fc->coin_priv, + sizeof (struct TALER_CoinSpendPrivateKeyP))) || + (0 != GNUNET_CRYPTO_rsa_signature_cmp (fc->sig.rsa_signature, + sigs[i].rsa_signature)) || + (0 != GNUNET_CRYPTO_rsa_public_key_cmp (fc->pk->key.rsa_public_key, + pubs[i].rsa_public_key)) ) + { + GNUNET_break (0); + fail (is); + return; + } + } break; default: break; |