本文整理汇总了C++中OTPseudonym::VerifyIssuedNum方法的典型用法代码示例。如果您正苦于以下问题:C++ OTPseudonym::VerifyIssuedNum方法的具体用法?C++ OTPseudonym::VerifyIssuedNum怎么用?C++ OTPseudonym::VerifyIssuedNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTPseudonym
的用法示例。
在下文中一共展示了OTPseudonym::VerifyIssuedNum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanRemoveItemFromCron
/// See if theNym has rights to remove this item from Cron.
///
bool OTAgreement::CanRemoveItemFromCron(OTPseudonym & theNym)
{
// You don't just go willy-nilly and remove a cron item from a market unless you check first
// and make sure the Nym who requested it actually has said number (or a related closing number)
// signed out to him on his last receipt...
//
if (true == OTCronItem::CanRemoveItemFromCron(theNym))
return true;
const OTString strServerID(GetServerID());
// Usually the Nym is the originator. (Meaning GetTransactionNum() on this agreement
// is still verifiable as an issued number on theNum, and belongs to him.) In that case,
// the above call will discover this, and return true.
// In other cases, theNym has the right to Remove the item even though theNym didn't originate it.
// (Like if he is the recipient -- not the sender -- in a payment plan.) We check such things
// HERE in this function (see below.)
//
if (false == theNym.CompareID(GetRecipientUserID()))
{
OTLog::Output(0, "OTAgreement::CanRemoveItemFromCron Weird: Nym tried to remove agreement (payment plan), even "
"though he apparently wasn't the sender OR recipient.\n");
return false;
}
else if (this->GetRecipientCountClosingNumbers() < 2)
{
OTLog::vOutput(0, "OTAgreement::CanRemoveItemFromCron Weird: Recipient tried to remove agreement "
"(or payment plan); expected 2 closing numbers to be available--that weren't. (Found %d).\n",
this->GetRecipientCountClosingNumbers());
return false;
}
if (false == theNym.VerifyIssuedNum(strServerID, this->GetRecipientClosingNum()))
{
OTLog::Output(0, "OTAgreement::CanRemoveItemFromCron: Recipient Closing number didn't verify (for removal from cron).\n");
return false;
}
// By this point, we KNOW theNym is the sender, and we KNOW there are the proper number of transaction
// numbers available to close. We also know that this cron item really was on the cron object, since
// that is where it was looked up from, when this function got called! So I'm pretty sure, at this point,
// to authorize removal, as long as the transaction num is still issued to theNym (this check here.)
//
return theNym.VerifyIssuedNum(strServerID, this->GetRecipientOpeningNum());
// Normally this will be all we need to check. The originator will have the transaction
// number signed-out to him still, if he is trying to close it. BUT--in some cases, someone
// who is NOT the originator can cancel. Like in a payment plan, the sender is also the depositor,
// who would normally be the person cancelling the plan. But technically, the RECIPIENT should
// also have the ability to cancel that payment plan. BUT: the transaction number isn't signed
// out to the RECIPIENT... In THAT case, the below VerifyIssuedNum() won't work! In those cases,
// expect that the special code will be in the subclasses override of this function. (OTPaymentPlan::CanRemoveItem() etc)
// P.S. If you override this function, MAKE SURE to call the parent (OTCronItem::CanRemoveItem) first,
// for the VerifyIssuedNum call above. Only if that fails, do you need to dig deeper...
}
示例2: HarvestClosingNumbers
// Used for adding transaction numbers back to a Nym, after deciding not to use this agreement
// or failing in trying to use it. Client side.
//
void OTAgreement::HarvestClosingNumbers(OTPseudonym & theNym)
{
// since we overrode the parent, we give it a chance to harvest also.
//
OTCronItem::HarvestClosingNumbers(theNym);
// The Nym is the original recipient. (If Compares true).
// FYI, if Nym is the original sender, then the above call will handle him.
//
// GetTransactionNum() is burned, but we can harvest the closing
// numbers from the "Closing" list, which is only for the sender's numbers.
// Subclasses will have to override this function for recipients, etc.
//
if (theNym.CompareID(GetRecipientUserID()))
{
const OTString strServerID(GetServerID());
for (int i = 0; i < GetRecipientCountClosingNumbers(); i++)
{
if (theNym.VerifyIssuedNum(strServerID, GetRecipientClosingTransactionNoAt(i))) // we only "add it back" if it was really there in the first place.
theNym.AddTransactionNum(theNym, strServerID, GetRecipientClosingTransactionNoAt(i),
(i == (GetRecipientCountClosingNumbers()-1) ? true : false)); // bSave=true only on the last iteration.
}
}
}
示例3: HarvestOpeningNumber
// You usually wouldn't want to use this, since if the transaction failed, the opening number
// is already burned and gone. But there might be cases where it's not, and you want to retrieve it.
// So I added this function.
//
void OTAgreement::HarvestOpeningNumber(OTPseudonym & theNym)
{
// since we overrode the parent, we give it a chance to harvest also.
//
OTCronItem::HarvestOpeningNumber(theNym);
// The Nym is the original sender. (If Compares true).
// IN CASES where GetTransactionNum() isn't already burned, we can harvest it here.
// Subclasses will have to override this function for recipients, etc.
//
if (theNym.CompareID(GetRecipientUserID()))
{
const OTString strServerID(GetServerID());
if (theNym.VerifyIssuedNum(strServerID, GetRecipientOpeningNum())) // we only "add it back" if it was really there in the first place.
theNym.AddTransactionNum(theNym, strServerID, GetRecipientOpeningNum(), true); // bSave=true
}
}
示例4: onFinalReceipt
//.........这里部分代码省略.........
else
{
OTString strNymID(NYM_ID);
OTLog::vError("OTAgreement::onFinalReceipt: Failure verifying Recipient's public key or loading signed nymfile: %s\n",
strNymID.Get());
}
}
// -------------------------------
// First, we are closing the transaction number ITSELF, of this cron item,
// as an active issued number on the originating nym. (Changing it to CLOSED.)
//
// Second, we're verifying the CLOSING number, and using it as the closing number
// on the FINAL RECEIPT (with that receipt being "InReferenceTo" this->GetTransactionNum())
//
const long lRecipientOpeningNumber = this->GetRecipientOpeningNum();
const long lRecipientClosingNumber = this->GetRecipientClosingNum();
// -----------------------------------------------------------------------------------
const long lSenderOpeningNumber = theOrigCronItem.GetTransactionNum();
const long lSenderClosingNumber = (theOrigCronItem.GetCountClosingNumbers() > 0) ?
theOrigCronItem.GetClosingTransactionNoAt(0) : 0; // index 0 is closing number for sender, since GetTransactionNum() is his opening #.
// ----------------------------------
const OTString strServerID(GetServerID());
// -----------------------------------------------------------------
//
if ((lSenderOpeningNumber > 0) &&
theOriginator.VerifyIssuedNum(strServerID, lSenderOpeningNumber))
{
// The Nym (server side) stores a list of all opening and closing cron #s.
// So when the number is released from the Nym, we also take it off that list.
//
std::set<long> & theIDSet = theOriginator.GetSetOpenCronItems();
theIDSet.erase(lSenderOpeningNumber);
// the RemoveIssued call means the original transaction# (to find this cron item on cron) is now CLOSED.
// But the Transaction itself is still OPEN. How? Because the CLOSING number is still signed out.
// The closing number is also USED, since the NotarizePaymentPlan or NotarizeMarketOffer call, but it
// remains ISSUED, until the final receipt itself is accepted during a process inbox.
//
theOriginator.RemoveIssuedNum(*pServerNym, strServerID, lSenderOpeningNumber, false); //bSave=false
theOriginator.SaveSignedNymfile(*pServerNym);
// ------------------------------------
OTPseudonym * pActualNym = NULL; // use this. DON'T use theActualNym.
OTPseudonym theActualNym; // unused unless it's really not already loaded. (use pActualNym.)
const OTIdentifier ACTUAL_NYM_ID = GetSenderUserID();
if ( (NULL != pServerNym) && pServerNym->CompareID(ACTUAL_NYM_ID) )
pActualNym = pServerNym;
else if (theOriginator.CompareID(ACTUAL_NYM_ID))
pActualNym = &theOriginator;
else if ( (NULL != pRemover) && pRemover->CompareID(ACTUAL_NYM_ID) )
pActualNym = pRemover;
// --------------------------
else // We couldn't find the Nym among those already loaded--so we have to load
{ // it ourselves (so we can update its NymboxHash value.)
theActualNym.SetIdentifier(ACTUAL_NYM_ID);
if (false == theActualNym.LoadPublicKey()) // Note: this step may be unnecessary since we are only updating his Nymfile, not his key.