summaryrefslogtreecommitdiff
path: root/src/exchange-lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-17 16:11:47 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-17 16:11:47 +0100
commitcf1ce4786356cba7d3f84a74fab282650f612db9 (patch)
tree744790593dd70e5338dd53e4e450364e53158999 /src/exchange-lib
parent4d058c4eb7283b1a77a877d583daaefa847213ec (diff)
downloadexchange-cf1ce4786356cba7d3f84a74fab282650f612db9.tar.gz
exchange-cf1ce4786356cba7d3f84a74fab282650f612db9.tar.bz2
exchange-cf1ce4786356cba7d3f84a74fab282650f612db9.zip
more work towards testing deposit confirmations
Diffstat (limited to 'src/exchange-lib')
-rw-r--r--src/exchange-lib/exchange_api_common.c25
-rw-r--r--src/exchange-lib/testing_api_cmd_deposit.c4
-rw-r--r--src/exchange-lib/testing_api_cmd_payback.c2
-rw-r--r--src/exchange-lib/testing_api_cmd_refresh.c4
-rw-r--r--src/exchange-lib/testing_api_cmd_refund.c2
-rw-r--r--src/exchange-lib/testing_api_cmd_track.c4
-rw-r--r--src/exchange-lib/testing_api_trait_coin_priv.c2
7 files changed, 34 insertions, 9 deletions
diff --git a/src/exchange-lib/exchange_api_common.c b/src/exchange-lib/exchange_api_common.c
index de05348f3..6b0aa6ff6 100644
--- a/src/exchange-lib/exchange_api_common.c
+++ b/src/exchange-lib/exchange_api_common.c
@@ -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 */
diff --git a/src/exchange-lib/testing_api_cmd_deposit.c b/src/exchange-lib/testing_api_cmd_deposit.c
index 4f3757f5d..59209fcc5 100644
--- a/src/exchange-lib/testing_api_cmd_deposit.c
+++ b/src/exchange-lib/testing_api_cmd_deposit.c
@@ -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,
diff --git a/src/exchange-lib/testing_api_cmd_payback.c b/src/exchange-lib/testing_api_cmd_payback.c
index 56026162a..43118ef0a 100644
--- a/src/exchange-lib/testing_api_cmd_payback.c
+++ b/src/exchange-lib/testing_api_cmd_payback.c
@@ -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;
diff --git a/src/exchange-lib/testing_api_cmd_refresh.c b/src/exchange-lib/testing_api_cmd_refresh.c
index 982b4d29d..93939bf8c 100644
--- a/src/exchange-lib/testing_api_cmd_refresh.c
+++ b/src/exchange-lib/testing_api_cmd_refresh.c
@@ -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;
diff --git a/src/exchange-lib/testing_api_cmd_refund.c b/src/exchange-lib/testing_api_cmd_refund.c
index 136ee631e..de70da27b 100644
--- a/src/exchange-lib/testing_api_cmd_refund.c
+++ b/src/exchange-lib/testing_api_cmd_refund.c
@@ -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;
diff --git a/src/exchange-lib/testing_api_cmd_track.c b/src/exchange-lib/testing_api_cmd_track.c
index c7fbf4086..201ac3f98 100644
--- a/src/exchange-lib/testing_api_cmd_track.c
+++ b/src/exchange-lib/testing_api_cmd_track.c
@@ -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;
diff --git a/src/exchange-lib/testing_api_trait_coin_priv.c b/src/exchange-lib/testing_api_trait_coin_priv.c
index 5e9193f1f..baaa794bd 100644
--- a/src/exchange-lib/testing_api_trait_coin_priv.c
+++ b/src/exchange-lib/testing_api_trait_coin_priv.c
@@ -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,