368 otOut <<
"OTItem::" << __FUNCTION__ <<
": wrong item type.\n";
377 if ((THE_ACCOUNT.GetBalance() + lActualAdjustment) !=
381 otOut <<
"OTItem::" << __FUNCTION__
382 <<
": This balance statement has a value of " <<
GetAmount()
384 << (THE_ACCOUNT.GetBalance() + lActualAdjustment)
386 "(Acct balance of " << THE_ACCOUNT.GetBalance()
387 <<
" plus actualAdjustment of " << lActualAdjustment <<
".)\n";
395 int32_t nInboxItemCount = 0, nOutboxItemCount = 0;
397 const char* szInbox =
"Inbox";
398 const char* szOutbox =
"Outbox";
400 const char* pszLedgerType =
nullptr;
414 int64_t lReceiptAmountMultiplier = 1;
416 OTLedger* pLedger =
nullptr;
418 switch (pSubItem->GetType()) {
427 pLedger = &THE_INBOX;
428 pszLedgerType = szInbox;
436 OTString strItemType;
438 otWarn <<
"OTItem::" << __FUNCTION__ <<
": Ignoring " << strItemType
439 <<
" item in balance statement while verifying it against "
445 switch (pSubItem->GetType()) {
447 if (pSubItem->GetAmount() < 0)
452 lReceiptAmountMultiplier =
455 pLedger = &THE_OUTBOX;
456 pszLedgerType = szOutbox;
462 lReceiptAmountMultiplier =
465 pLedger = &THE_INBOX;
466 pszLedgerType = szInbox;
491 lReceiptAmountMultiplier = 1;
494 otErr <<
"OTItem::" << __FUNCTION__
495 <<
": Bad Subitem type (SHOULD NEVER HAPPEN)....\n";
501 OTTransaction* pTransaction =
nullptr;
534 if ((lOutboxTrnsNum > 0) && (&THE_OUTBOX == pLedger) &&
535 (pSubItem->GetTransactionNum() == 1))
538 otLog3 <<
"OTItem::" << __FUNCTION__
539 <<
": Subitem is new Outbox Transaction... retrieving by "
540 "special ID: " << lOutboxTrnsNum <<
"\n";
542 pTransaction = pLedger->GetTransaction(lOutboxTrnsNum);
545 otLog4 <<
"OTItem::" << __FUNCTION__
546 <<
": Subitem is normal Transaction... retrieving by ID: "
547 << pSubItem->GetTransactionNum() <<
"\n";
550 pLedger->GetTransaction(pSubItem->GetTransactionNum());
555 if (
nullptr == pTransaction) {
556 otOut <<
"OTItem::" << __FUNCTION__ <<
": Expected "
557 << pszLedgerType <<
" transaction (serv " << lOutboxTrnsNum
558 <<
", client " << pSubItem->GetTransactionNum()
560 "not found. (Amount " << pSubItem->GetAmount() <<
".)\n";
565 if (pSubItem->GetReferenceToNum() !=
566 pTransaction->GetReferenceToNum()) {
567 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
568 <<
" transaction (" << pSubItem->GetTransactionNum()
569 <<
") mismatch Reference Num: "
570 << pSubItem->GetReferenceToNum() <<
", expected "
571 << pTransaction->GetReferenceToNum() <<
"\n";
575 if (pSubItem->GetRawNumberOfOrigin() !=
576 pTransaction->GetRawNumberOfOrigin()) {
577 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
578 <<
" transaction (" << pSubItem->GetTransactionNum()
579 <<
") mismatch Origin Num: "
580 << pSubItem->GetRawNumberOfOrigin() <<
", expected "
581 << pTransaction->GetRawNumberOfOrigin() <<
"\n";
629 int64_t lTransactionAmount = pTransaction->GetReceiptAmount();
630 lTransactionAmount *= lReceiptAmountMultiplier;
632 if (pSubItem->GetAmount() != lTransactionAmount) {
633 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
634 <<
" transaction (" << pSubItem->GetTransactionNum()
636 "amounts don't match: report amount is "
637 << pSubItem->GetAmount() <<
", but expected "
638 << lTransactionAmount
639 <<
". Trans Receipt Amt: " << pTransaction->GetReceiptAmount()
640 <<
" (GetAmount() == " <<
GetAmount() <<
".)\n";
646 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
647 <<
" transaction (" << pSubItem->GetTransactionNum()
648 <<
") wrong type. (transfer block)\n";
654 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
655 <<
" transaction (" << pSubItem->GetTransactionNum()
656 <<
") wrong type. (chequeReceipt block)\n";
662 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
663 <<
" transaction (" << pSubItem->GetTransactionNum()
664 <<
") wrong type. (voucherReceipt block)\n";
670 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
671 <<
" transaction (" << pSubItem->GetTransactionNum()
672 <<
") wrong type. (marketReceipt block)\n";
678 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
679 <<
" transaction (" << pSubItem->GetTransactionNum()
680 <<
") wrong type. (paymentReceipt block)\n";
686 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
687 <<
" transaction (" << pSubItem->GetTransactionNum()
688 <<
") wrong type. (transferReceipt block)\n";
694 (pSubItem->GetClosingNum() != pTransaction->GetClosingNum()))) {
695 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
696 <<
" transaction (" << pSubItem->GetTransactionNum()
697 <<
") wrong type or closing num ("
698 << pSubItem->GetClosingNum() <<
"). "
699 "(basketReceipt block)\n";
705 (pSubItem->GetClosingNum() != pTransaction->GetClosingNum()))) {
706 otOut <<
"OTItem::" << __FUNCTION__ <<
": " << pszLedgerType
707 <<
" transaction (" << pSubItem->GetTransactionNum()
708 <<
") wrong type or closing num ("
709 << pSubItem->GetClosingNum() <<
"). "
710 "(finalReceipt block)\n";
720 if ((nInboxItemCount != THE_INBOX.GetTransactionCount()) ||
721 (nOutboxItemCount != THE_OUTBOX.GetTransactionCount())) {
722 otOut <<
"OTItem::" << __FUNCTION__
723 <<
": Inbox or Outbox mismatch in expected transaction count.\n"
724 " --- THE_INBOX count: " << THE_INBOX.GetTransactionCount()
725 <<
" --- THE_OUTBOX count: " << THE_OUTBOX.GetTransactionCount()
727 "--- nInboxItemCount count: " << nInboxItemCount
728 <<
" --- nOutboxItemCount count: " << nOutboxItemCount <<
"\n\n";
756 OTPseudonym theRemovedNym;
770 otOut <<
"OTItem::" << __FUNCTION__ <<
": Transaction has # that "
771 "doesn't appear on Nym's issued "
806 switch (TARGET_TRANSACTION.GetType()) {
819 if (THE_NYM.RemoveIssuedNum(SERVER_ID,
833 otErr <<
"OTItem::" << __FUNCTION__
834 <<
": wrong target transaction type: "
835 << TARGET_TRANSACTION.GetTypeString() <<
"\n";
838 int32_t nNumberOfTransactionNumbers1 = 0;
839 int32_t nNumberOfTransactionNumbers2 = 0;
841 OTString strMessageNym;
846 for (
auto& it : THE_NYM.GetMapIssuedNum()) {
847 std::string strServerID = it.first;
851 const OTIdentifier theServerID(strServerID.c_str());
854 nNumberOfTransactionNumbers1 +=
855 static_cast<int32_t
>(pDeque->size());
865 OTPseudonym theMessageNym;
867 if ((strMessageNym.GetLength() > 2) &&
868 theMessageNym.LoadFromString(strMessageNym)) {
869 for (
auto& it : theMessageNym.GetMapIssuedNum()) {
870 std::string strServerID = it.first;
874 const OTIdentifier theServerID(strServerID.c_str());
875 const OTString OTstrServerID(theServerID);
878 nNumberOfTransactionNumbers2 +=
879 static_cast<int32_t
>(pDeque->size());
881 for (uint32_t i = 0; i < pDeque->size(); i++) {
882 int64_t lTransactionNumber = pDeque->at(i);
884 THE_NYM.VerifyIssuedNum(OTstrServerID,
887 otOut <<
"OTItem::" << __FUNCTION__
888 <<
": Issued transaction # " << lTransactionNumber
889 <<
" from Message Nym not found on this side.\n";
892 switch (TARGET_TRANSACTION.GetType()) {
901 i < theRemovedNym.GetIssuedNumCount(
904 int64_t lTemp = theRemovedNym.GetIssuedNum(
908 otErr <<
"OTItem::" << __FUNCTION__
909 <<
": THIS SHOULD NOT HAPPEN.\n";
911 THE_NYM.AddIssuedNum(
913 otErr <<
"OTItem::" << __FUNCTION__
914 <<
": Failed adding issued number "
915 "back to THE_NYM.\n";
926 otErr <<
"OTItem::" << __FUNCTION__
927 <<
": wrong target transaction type: "
928 << TARGET_TRANSACTION.GetTypeString() <<
"\n";
942 if (nNumberOfTransactionNumbers1 != nNumberOfTransactionNumbers2) {
943 otOut <<
"OTItem::" << __FUNCTION__
944 <<
": Transaction # Count mismatch: "
945 << nNumberOfTransactionNumbers1 <<
" and "
946 << nNumberOfTransactionNumbers2 <<
"\n";
949 switch (TARGET_TRANSACTION.GetType()) {
964 otErr <<
"OTItem::" << __FUNCTION__
965 <<
": THIS SHOULD NOT HAPPEN.\n";
967 THE_NYM.AddIssuedNum(SERVER_ID,
969 otErr <<
"OTItem::" << __FUNCTION__
970 <<
": Failed adding issued number back to THE_NYM.\n";
981 otErr <<
"OTItem::" << __FUNCTION__
982 <<
": wrong target transaction type: "
983 << TARGET_TRANSACTION.GetTypeString() <<
"\n";
1010 switch (TARGET_TRANSACTION.GetType()) {
1024 otErr <<
"OTItem::" << __FUNCTION__
1025 <<
": THIS SHOULD NOT HAPPEN.\n";
1027 THE_NYM.AddIssuedNum(SERVER_ID, lTemp))
1028 otErr <<
"OTItem::" << __FUNCTION__
1029 <<
": Failed adding issued number back to THE_NYM.\n";
1040 otErr <<
"OTItem::" << __FUNCTION__
1041 <<
": wrong target transaction type: "
1042 << TARGET_TRANSACTION.GetTypeString() <<
"\n";
OTLOG_IMPORT OTLogStream otLog4
OTItem * GetItem(int32_t nIndex)
EXPORT void GetAttachment(OTString &theStr) const
OTLOG_IMPORT OTLogStream otOut
OTLOG_IMPORT OTLogStream otLog3
const OTIdentifier & GetPurportedServerID() const
int64_t GetAmount() const
std::deque< int64_t > dequeOfTransNums
OTLOG_IMPORT OTLogStream otWarn
OTLOG_IMPORT OTLogStream otErr
EXPORT int64_t GetTransactionNum() const
int32_t GetItemCount() const
OTItem::itemType GetType() const
void GetTypeString(OTString &strType) const