more work towards testing deposit confirmations

This commit is contained in:
Christian Grothoff 2018-11-17 16:11:47 +01:00
parent 4d058c4eb7
commit cf1ce47863
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
10 changed files with 67 additions and 30 deletions

View File

@ -191,17 +191,15 @@ deposit_confirmation_run (void *cls,
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Absolute refund_deadline;
const struct TALER_Amount *amount_without_fee;
const struct TALER_CoinSpendPublicKeyP *coin_pub;
struct TALER_CoinSpendPublicKeyP coin_pub;
const struct TALER_MerchantPublicKeyP *merchant_pub;
const struct TALER_ExchangePublicKeyP *exchange_pub;
const struct TALER_ExchangeSignatureP *exchange_sig;
const struct TALER_MasterPublicKeyP *master_pub;
struct GNUNET_TIME_Absolute ep_start;
struct GNUNET_TIME_Absolute ep_expire;
struct GNUNET_TIME_Absolute ep_end;
const struct TALER_MasterSignatureP *master_sig;
const json_t *wire_details;
const json_t *contract_terms;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_EXCHANGE_Keys *keys;
const struct TALER_EXCHANGE_SigningPublicKey *spk;
dcs->is = is;
this_cmd = &is->commands[is->ip]; // use this_cmd->label for logging!
@ -225,7 +223,11 @@ deposit_confirmation_run (void *cls,
TALER_TESTING_get_trait_exchange_sig (deposit_cmd,
dcs->coin_index,
&exchange_sig));
keys = TALER_EXCHANGE_get_keys (dcs->is->exchange);
GNUNET_assert (NULL != keys);
spk = TALER_EXCHANGE_get_exchange_signing_key_info (keys,
exchange_pub);
#if 0
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_contract_terms (deposit_cmd,
@ -240,16 +242,13 @@ deposit_confirmation_run (void *cls,
&wire_details));
TALER_JSON_hash (wire_details,
&h_wire);
#if 0
// FIXME: extract from deposit trait!
/* Fixme: do prefer "interpreter fail" over assertions,
* as the former takes care of shutting down processes, too */
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_coin_priv (deposit_cmd,
ds->coin_index,
dcs->coin_index,
&coin_priv));
#endif
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
&coin_pub.eddsa_pub);
dcs->dc = TALER_AUDITOR_deposit_confirmation
(dcs->auditor,
@ -258,15 +257,15 @@ deposit_confirmation_run (void *cls,
timestamp,
refund_deadline,
amount_without_fee,
coin_pub,
&coin_pub,
merchant_pub,
exchange_pub,
exchange_sig,
master_pub,
ep_start,
ep_expire,
ep_end,
master_sig,
&keys->master_pub,
spk->valid_from,
spk->valid_until,
spk->valid_legal,
&spk->master_sig,
&deposit_confirmation_cb,
dcs);

View File

@ -325,4 +325,29 @@ TALER_EXCHANGE_verify_coin_history (const char *currency,
}
/**
* Obtain meta data about an exchange (online) signing
* key.
*
* @param keys from where to obtain the meta data
* @param exchange_pub public key to lookup
* @return NULL on error (@a exchange_pub not known)
*/
const struct TALER_EXCHANGE_SigningPublicKey *
TALER_EXCHANGE_get_exchange_signing_key_info (const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ExchangePublicKeyP *exchange_pub)
{
for (unsigned int i=0;i<keys->num_sign_keys;i++)
{
const struct TALER_EXCHANGE_SigningPublicKey *spk;
spk = &keys->sign_keys[i];
if (0 == memcmp (exchange_pub,
&spk->key,
sizeof (struct TALER_ExchangePublicKeyP)))
return spk;
}
return NULL;
}
/* end of exchange_api_common.c */

View File

@ -246,7 +246,7 @@ deposit_run (void *cls,
struct DepositState *ds = cls;
const struct TALER_TESTING_Command *coin_cmd;
struct TALER_TESTING_Command *this_cmd;
struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
struct TALER_CoinSpendPublicKeyP coin_pub;
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
struct TALER_DenominationSignature *denom_pub_sig;
@ -450,7 +450,7 @@ deposit_traits (void *cls,
struct DepositState *ds = cls;
const struct TALER_TESTING_Command *coin_cmd;
/* Will point to coin cmd internals. */
struct TALER_CoinSpendPrivateKeyP *coin_spent_priv;
const struct TALER_CoinSpendPrivateKeyP *coin_spent_priv;
coin_cmd = TALER_TESTING_interpreter_lookup_command
(ds->is,

View File

@ -224,7 +224,7 @@ payback_run (void *cls,
{
struct PaybackState *ps = cls;
const struct TALER_TESTING_Command *coin_cmd;
struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
struct TALER_DenominationBlindingKeyP *blinding_key;
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
struct TALER_DenominationSignature *coin_sig;

View File

@ -715,7 +715,7 @@ refresh_link_run (void *cls,
}
}
struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv
(coin_cmd, 0, &coin_priv))
{
@ -903,7 +903,7 @@ refresh_melt_run (void *cls,
(num_fresh_coins,
struct TALER_EXCHANGE_DenomPublicKey);
{
struct TALER_CoinSpendPrivateKeyP *melt_priv;
const struct TALER_CoinSpendPrivateKeyP *melt_priv;
struct TALER_Amount melt_amount;
struct TALER_Amount fresh_amount;
struct TALER_DenominationSignature *melt_sig;

View File

@ -143,7 +143,7 @@ refund_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct RefundState *rs = cls;
struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
struct TALER_CoinSpendPublicKeyP coin;
const char *contract_terms;
struct GNUNET_HashCode h_contract_terms;

View File

@ -259,14 +259,14 @@ deposit_wtid_cb
* @param cmd the command to execute.
* @param is the interpreter state.
*/
void
static void
track_transaction_run (void *cls,
const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is)
{
struct TrackTransactionState *tts = cls;
const struct TALER_TESTING_Command *transaction_cmd;
struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
struct TALER_CoinSpendPublicKeyP coin_pub;
const char *contract_terms;
const json_t *wire_details;

View File

@ -46,7 +46,7 @@ int
TALER_TESTING_get_trait_coin_priv
(const struct TALER_TESTING_Command *cmd,
unsigned int index,
struct TALER_CoinSpendPrivateKeyP **coin_priv)
const struct TALER_CoinSpendPrivateKeyP **coin_priv)
{
return cmd->traits (cmd->cls,
(void **) coin_priv,

View File

@ -484,6 +484,19 @@ TALER_EXCHANGE_get_denomination_key_by_hash (const struct TALER_EXCHANGE_Keys *k
const struct GNUNET_HashCode *hc);
/**
* Obtain meta data about an exchange (online) signing
* key.
*
* @param keys from where to obtain the meta data
* @param exchange_pub public key to lookup
* @return NULL on error (@a exchange_pub not known)
*/
const struct TALER_EXCHANGE_SigningPublicKey *
TALER_EXCHANGE_get_exchange_signing_key_info (const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ExchangePublicKeyP *exchange_pub);
/* ********************* /wire *********************** */

View File

@ -1656,7 +1656,7 @@ int
TALER_TESTING_get_trait_coin_priv
(const struct TALER_TESTING_Command *cmd,
unsigned int index,
struct TALER_CoinSpendPrivateKeyP **coin_priv);
const struct TALER_CoinSpendPrivateKeyP **coin_priv);
/**
* Offer blinding key.