summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-04 18:09:39 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-04 18:09:39 +0100
commit1c84b3d4af1a2484e60a9071556d4690dd7aac33 (patch)
tree53c69a66f1d903042082881d52946d00603fb432 /src/exchangedb
parente3dcc27b680f25a2041781bbedc0219e05608bad (diff)
downloadexchange-1c84b3d4af1a2484e60a9071556d4690dd7aac33.tar.gz
exchange-1c84b3d4af1a2484e60a9071556d4690dd7aac33.tar.bz2
exchange-1c84b3d4af1a2484e60a9071556d4690dd7aac33.zip
implementing #4932
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/exchangedb_fees.c12
-rw-r--r--src/exchangedb/test_exchangedb_fees.c7
2 files changed, 15 insertions, 4 deletions
diff --git a/src/exchangedb/exchangedb_fees.c b/src/exchangedb/exchangedb_fees.c
index 5adee5d41..e3e16712d 100644
--- a/src/exchangedb/exchangedb_fees.c
+++ b/src/exchangedb/exchangedb_fees.c
@@ -142,17 +142,22 @@ TALER_EXCHANGEDB_fees_read (const struct GNUNET_CONFIGURATION_Handle *cfg,
/**
* Convert @a af to @a wf.
*
+ * @param wireplugin name of the wire plugin the fees are for
* @param[in,out] af aggregate fees, host format (updated to round time)
* @param[out] wf aggregate fees, disk / signature format
*/
void
-TALER_EXCHANGEDB_fees_2_wf (struct TALER_EXCHANGEDB_AggregateFees *af,
+TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
+ struct TALER_EXCHANGEDB_AggregateFees *af,
struct TALER_MasterWireFeePS *wf)
{
(void) GNUNET_TIME_round_abs (&af->start_date);
(void) GNUNET_TIME_round_abs (&af->end_date);
wf->purpose.size = htonl (sizeof (*wf));
wf->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES);
+ GNUNET_CRYPTO_hash (wireplugin,
+ strlen (wireplugin) + 1,
+ &wf->h_wire_method);
wf->start_date = GNUNET_TIME_absolute_hton (af->start_date);
wf->end_date = GNUNET_TIME_absolute_hton (af->end_date);
TALER_amount_hton (&wf->wire_fee,
@@ -164,11 +169,13 @@ TALER_EXCHANGEDB_fees_2_wf (struct TALER_EXCHANGEDB_AggregateFees *af,
* Write given fee structure to disk.
*
* @param filename where to write the fees
+ * @param wireplugin which plugin the fees are about
* @param af fee structure to write
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
TALER_EXCHANGEDB_fees_write (const char *filename,
+ const char *wireplugin,
struct TALER_EXCHANGEDB_AggregateFees *af)
{
struct GNUNET_DISK_FileHandle *fh;
@@ -201,7 +208,8 @@ TALER_EXCHANGEDB_fees_write (const char *filename,
GNUNET_DISK_file_close (fh));
return GNUNET_SYSERR;
}
- TALER_EXCHANGEDB_fees_2_wf (af,
+ TALER_EXCHANGEDB_fees_2_wf (wireplugin,
+ af,
&wd.wf);
wd.master_sig = af->master_sig;
af = af->next;
diff --git a/src/exchangedb/test_exchangedb_fees.c b/src/exchangedb/test_exchangedb_fees.c
index b82abc5fd..2bee77452 100644
--- a/src/exchangedb/test_exchangedb_fees.c
+++ b/src/exchangedb/test_exchangedb_fees.c
@@ -36,7 +36,8 @@ sign_af (struct TALER_EXCHANGEDB_AggregateFees *af,
{
struct TALER_MasterWireFeePS wf;
- TALER_EXCHANGEDB_fees_2_wf (af,
+ TALER_EXCHANGEDB_fees_2_wf ("test",
+ af,
&wf);
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (priv,
@@ -99,6 +100,7 @@ main (int argc,
if (GNUNET_OK !=
TALER_EXCHANGEDB_fees_write (tmpfile,
+ "test",
af))
{
GNUNET_break (0);
@@ -121,7 +123,8 @@ main (int argc,
{
struct TALER_MasterWireFeePS wf;
- TALER_EXCHANGEDB_fees_2_wf (p,
+ TALER_EXCHANGEDB_fees_2_wf ("test",
+ p,
&wf);
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES,