diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-01-04 00:41:19 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-01-04 00:41:19 +0100 |
commit | 5587732f5276621ada83a53d1fb0ee8b6f80032b (patch) | |
tree | ed9ac4c527e205ba466c8f4da4da5f740d437bc2 /src/auditor | |
parent | d9f16db0efca71d47455ee2efab7eabf4003a0a0 (diff) | |
download | exchange-5587732f5276621ada83a53d1fb0ee8b6f80032b.tar.xz |
fix auditor to properly verify wire fee signatures and more gracefully handle arithmetic amount issue
Diffstat (limited to 'src/auditor')
-rw-r--r-- | src/auditor/taler-auditor.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index 870a81a42..89f044608 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -1664,10 +1664,15 @@ struct WireFeeInfo struct GNUNET_TIME_Absolute end_date; /** - * How high is the fee. + * How high is the wire fee. */ struct TALER_Amount wire_fee; + /** + * How high is the closing fee. + */ + struct TALER_Amount closing_fee; + }; @@ -1815,6 +1820,7 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_Amount spent; struct TALER_Amount value; struct TALER_Amount merchant_loss; + struct TALER_Amount merchant_delta; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking transaction history of coin %s\n", @@ -2043,7 +2049,7 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub, /* Finally, update @a merchant_gain by subtracting what he "lost" from refunds */ if (GNUNET_SYSERR == - TALER_amount_subtract (merchant_gain, + TALER_amount_subtract (&merchant_delta, merchant_gain, &merchant_loss)) { @@ -2055,6 +2061,7 @@ check_transaction_history (const struct TALER_CoinSpendPublicKeyP *coin_pub, 0); return GNUNET_SYSERR; } + *merchant_gain = merchant_delta; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Coin %s contributes %s to contract %s\n", TALER_B2S (coin_pub), @@ -2276,6 +2283,7 @@ get_wire_fee (struct AggregationContext *ac, &wfi->start_date, &wfi->end_date, &wfi->wire_fee, + &wfi->closing_fee, &master_sig)) { GNUNET_break (0); @@ -2299,6 +2307,8 @@ get_wire_fee (struct AggregationContext *ac, wp.end_date = GNUNET_TIME_absolute_hton (wfi->end_date); TALER_amount_hton (&wp.wire_fee, &wfi->wire_fee); + TALER_amount_hton (&wp.closing_fee, + &wfi->closing_fee); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES, &wp.purpose, |