diff options
Diffstat (limited to 'src/auditor/taler-auditor.c')
-rw-r--r-- | src/auditor/taler-auditor.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index 536a5cabe..347f3af65 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c | |||
@@ -1384,6 +1384,7 @@ verify_reserve_balance (void *cls, | |||
1384 | struct ReserveSummary *rs = value; | 1384 | struct ReserveSummary *rs = value; |
1385 | struct TALER_EXCHANGEDB_Reserve reserve; | 1385 | struct TALER_EXCHANGEDB_Reserve reserve; |
1386 | struct TALER_Amount balance; | 1386 | struct TALER_Amount balance; |
1387 | struct TALER_Amount nbalance; | ||
1387 | enum GNUNET_DB_QueryStatus qs; | 1388 | enum GNUNET_DB_QueryStatus qs; |
1388 | int ret; | 1389 | int ret; |
1389 | 1390 | ||
@@ -1422,7 +1423,7 @@ verify_reserve_balance (void *cls, | |||
1422 | } | 1423 | } |
1423 | 1424 | ||
1424 | if (GNUNET_SYSERR == | 1425 | if (GNUNET_SYSERR == |
1425 | TALER_amount_subtract (&balance, | 1426 | TALER_amount_subtract (&nbalance, |
1426 | &balance, | 1427 | &balance, |
1427 | &rs->total_out)) | 1428 | &rs->total_out)) |
1428 | { | 1429 | { |
@@ -1437,25 +1438,25 @@ verify_reserve_balance (void *cls, | |||
1437 | &total_balance_insufficient_loss, | 1438 | &total_balance_insufficient_loss, |
1438 | &loss)); | 1439 | &loss)); |
1439 | report (report_reserve_balance_insufficient_inconsistencies, | 1440 | report (report_reserve_balance_insufficient_inconsistencies, |
1440 | json_pack ("{s:o, s:o, s:o, s:s}", | 1441 | json_pack ("{s:o, s:o}", |
1441 | "reserve_pub", | 1442 | "reserve_pub", |
1442 | GNUNET_JSON_from_data_auto (&rs->reserve_pub), | 1443 | GNUNET_JSON_from_data_auto (&rs->reserve_pub), |
1443 | "loss", | 1444 | "loss", |
1444 | TALER_JSON_from_amount (&loss))); | 1445 | TALER_JSON_from_amount (&loss))); |
1445 | goto cleanup; | 1446 | goto cleanup; |
1446 | } | 1447 | } |
1447 | if (0 != TALER_amount_cmp (&balance, | 1448 | if (0 != TALER_amount_cmp (&nbalance, |
1448 | &reserve.balance)) | 1449 | &reserve.balance)) |
1449 | { | 1450 | { |
1450 | struct TALER_Amount delta; | 1451 | struct TALER_Amount delta; |
1451 | 1452 | ||
1452 | if (0 < TALER_amount_cmp (&balance, | 1453 | if (0 < TALER_amount_cmp (&nbalance, |
1453 | &reserve.balance)) | 1454 | &reserve.balance)) |
1454 | { | 1455 | { |
1455 | /* balance > reserve.balance */ | 1456 | /* balance > reserve.balance */ |
1456 | GNUNET_assert (GNUNET_OK == | 1457 | GNUNET_assert (GNUNET_OK == |
1457 | TALER_amount_subtract (&delta, | 1458 | TALER_amount_subtract (&delta, |
1458 | &balance, | 1459 | &nbalance, |
1459 | &reserve.balance)); | 1460 | &reserve.balance)); |
1460 | GNUNET_assert (GNUNET_OK == | 1461 | GNUNET_assert (GNUNET_OK == |
1461 | TALER_amount_add (&total_balance_summary_delta_plus, | 1462 | TALER_amount_add (&total_balance_summary_delta_plus, |
@@ -1468,7 +1469,7 @@ verify_reserve_balance (void *cls, | |||
1468 | GNUNET_assert (GNUNET_OK == | 1469 | GNUNET_assert (GNUNET_OK == |
1469 | TALER_amount_subtract (&delta, | 1470 | TALER_amount_subtract (&delta, |
1470 | &reserve.balance, | 1471 | &reserve.balance, |
1471 | &balance)); | 1472 | &nbalance)); |
1472 | GNUNET_assert (GNUNET_OK == | 1473 | GNUNET_assert (GNUNET_OK == |
1473 | TALER_amount_add (&total_balance_summary_delta_minus, | 1474 | TALER_amount_add (&total_balance_summary_delta_minus, |
1474 | &total_balance_summary_delta_minus, | 1475 | &total_balance_summary_delta_minus, |
@@ -1481,7 +1482,7 @@ verify_reserve_balance (void *cls, | |||
1481 | "exchange", | 1482 | "exchange", |
1482 | TALER_JSON_from_amount (&reserve.balance), | 1483 | TALER_JSON_from_amount (&reserve.balance), |
1483 | "auditor", | 1484 | "auditor", |
1484 | TALER_JSON_from_amount (&balance))); | 1485 | TALER_JSON_from_amount (&nbalance))); |
1485 | goto cleanup; | 1486 | goto cleanup; |
1486 | } | 1487 | } |
1487 | 1488 | ||
@@ -1489,19 +1490,19 @@ verify_reserve_balance (void *cls, | |||
1489 | if ( (CLOSING_GRACE_PERIOD.rel_value_us > | 1490 | if ( (CLOSING_GRACE_PERIOD.rel_value_us > |
1490 | GNUNET_TIME_absolute_get_duration ( | 1491 | GNUNET_TIME_absolute_get_duration ( |
1491 | rs->a_expiration_date).rel_value_us) && | 1492 | rs->a_expiration_date).rel_value_us) && |
1492 | ( (0 != balance.value) || | 1493 | ( (0 != nbalance.value) || |
1493 | (0 != balance.fraction) ) ) | 1494 | (0 != nbalance.fraction) ) ) |
1494 | { | 1495 | { |
1495 | GNUNET_assert (GNUNET_OK == | 1496 | GNUNET_assert (GNUNET_OK == |
1496 | TALER_amount_add (&total_balance_reserve_not_closed, | 1497 | TALER_amount_add (&total_balance_reserve_not_closed, |
1497 | &total_balance_reserve_not_closed, | 1498 | &total_balance_reserve_not_closed, |
1498 | &balance)); | 1499 | &nbalance)); |
1499 | report (report_reserve_not_closed_inconsistencies, | 1500 | report (report_reserve_not_closed_inconsistencies, |
1500 | json_pack ("{s:o, s:o, s:s}", | 1501 | json_pack ("{s:o, s:o, s:s}", |
1501 | "reserve_pub", | 1502 | "reserve_pub", |
1502 | GNUNET_JSON_from_data_auto (&rs->reserve_pub), | 1503 | GNUNET_JSON_from_data_auto (&rs->reserve_pub), |
1503 | "balance", | 1504 | "balance", |
1504 | TALER_JSON_from_amount (&balance), | 1505 | TALER_JSON_from_amount (&nbalance), |
1505 | "expiration_time", | 1506 | "expiration_time", |
1506 | GNUNET_STRINGS_absolute_time_to_string ( | 1507 | GNUNET_STRINGS_absolute_time_to_string ( |
1507 | rs->a_expiration_date))); | 1508 | rs->a_expiration_date))); |
@@ -1548,7 +1549,7 @@ verify_reserve_balance (void *cls, | |||
1548 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1549 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1549 | "Final balance of reserve `%s' is %s, dropping it\n", | 1550 | "Final balance of reserve `%s' is %s, dropping it\n", |
1550 | TALER_B2S (&rs->reserve_pub), | 1551 | TALER_B2S (&rs->reserve_pub), |
1551 | TALER_amount2s (&balance)); | 1552 | TALER_amount2s (&nbalance)); |
1552 | qs = adb->del_reserve_info (adb->cls, | 1553 | qs = adb->del_reserve_info (adb->cls, |
1553 | asession, | 1554 | asession, |
1554 | &rs->reserve_pub, | 1555 | &rs->reserve_pub, |
@@ -1566,7 +1567,7 @@ verify_reserve_balance (void *cls, | |||
1566 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1567 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1567 | "Final balance of reserve `%s' is %s, no need to remember it\n", | 1568 | "Final balance of reserve `%s' is %s, no need to remember it\n", |
1568 | TALER_B2S (&rs->reserve_pub), | 1569 | TALER_B2S (&rs->reserve_pub), |
1569 | TALER_amount2s (&balance)); | 1570 | TALER_amount2s (&nbalance)); |
1570 | } | 1571 | } |
1571 | ret = GNUNET_OK; | 1572 | ret = GNUNET_OK; |
1572 | goto cleanup; | 1573 | goto cleanup; |
@@ -1575,14 +1576,14 @@ verify_reserve_balance (void *cls, | |||
1575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1576 | "Remembering final balance of reserve `%s' as %s\n", | 1577 | "Remembering final balance of reserve `%s' as %s\n", |
1577 | TALER_B2S (&rs->reserve_pub), | 1578 | TALER_B2S (&rs->reserve_pub), |
1578 | TALER_amount2s (&balance)); | 1579 | TALER_amount2s (&nbalance)); |
1579 | 1580 | ||
1580 | if (rs->had_ri) | 1581 | if (rs->had_ri) |
1581 | qs = adb->update_reserve_info (adb->cls, | 1582 | qs = adb->update_reserve_info (adb->cls, |
1582 | asession, | 1583 | asession, |
1583 | &rs->reserve_pub, | 1584 | &rs->reserve_pub, |
1584 | &master_pub, | 1585 | &master_pub, |
1585 | &balance, | 1586 | &nbalance, |
1586 | &rs->a_withdraw_fee_balance, | 1587 | &rs->a_withdraw_fee_balance, |
1587 | rs->a_expiration_date); | 1588 | rs->a_expiration_date); |
1588 | else | 1589 | else |
@@ -1590,7 +1591,7 @@ verify_reserve_balance (void *cls, | |||
1590 | asession, | 1591 | asession, |
1591 | &rs->reserve_pub, | 1592 | &rs->reserve_pub, |
1592 | &master_pub, | 1593 | &master_pub, |
1593 | &balance, | 1594 | &nbalance, |
1594 | &rs->a_withdraw_fee_balance, | 1595 | &rs->a_withdraw_fee_balance, |
1595 | rs->a_expiration_date); | 1596 | rs->a_expiration_date); |
1596 | if (0 >= qs) | 1597 | if (0 >= qs) |
@@ -2774,10 +2775,8 @@ check_wire_out_cb | |||
2774 | 2775 | ||
2775 | report (report_wire_out_inconsistencies, | 2776 | report (report_wire_out_inconsistencies, |
2776 | json_pack ("{s:O, s:I, s:o, s:o}", | 2777 | json_pack ("{s:O, s:I, s:o, s:o}", |
2777 | "destination_account", | 2778 | "destination_account", wire, |
2778 | wire, | 2779 | "rowid", (json_int_t) rowid, |
2779 | "rowid", | ||
2780 | (json_int_t) rowid, | ||
2781 | "expected", | 2780 | "expected", |
2782 | TALER_JSON_from_amount (&final_amount), | 2781 | TALER_JSON_from_amount (&final_amount), |
2783 | "claimed", | 2782 | "claimed", |