本文整理汇总了C++中OTPseudonym::SaveSignedNymfile方法的典型用法代码示例。如果您正苦于以下问题:C++ OTPseudonym::SaveSignedNymfile方法的具体用法?C++ OTPseudonym::SaveSignedNymfile怎么用?C++ OTPseudonym::SaveSignedNymfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTPseudonym
的用法示例。
在下文中一共展示了OTPseudonym::SaveSignedNymfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HarvestClosingNumbers
// This is a good implementation. Dots all the i's, so to speak.
// client-side.
// The basket ONLY stores closing numbers, so this means "harvest 'em all."
//
void OTBasket::HarvestClosingNumbers(OTPseudonym & theNym, const OTIdentifier & theServerID, const bool bSave/*=true*/)
{
const OTString strServerID(theServerID);
bool bNeedToSave = false;
// *************************************************************************
// The SUB-CURRENCIES first...
//
const unsigned int nCount = static_cast<unsigned int>(this->Count());
for (unsigned int i = 0; i < nCount; i++)
{
BasketItem * pRequestItem = this->At(i);
OT_ASSERT(NULL != pRequestItem);
// --------------------------------
const long lClosingTransNo = pRequestItem->lClosingTransactionNo;
// --------------------------------
// This function will only "add it back" if it was really there in the first place.
// (Verifies it is on issued list first, before adding to available list.)
//
const bool bClawedBack = theNym.ClawbackTransactionNumber(theServerID, lClosingTransNo, false); // bSave=false
if (bClawedBack)
bNeedToSave = true;
// else
// OTLog::vError("OTBasket::HarvestClosingNumbers: Number (%ld) failed as issued. (Thus didn't bother 'adding it back'.)\n",
// lClosingTransNo);
} // for
// *************************************************************************
// Then the BASKET currency itself...
//
const long lClosingTransNo = this->GetClosingNum();
// --------------------------------
// This function will only "add it back" if it was really there in the first place.
// (Verifies it is on issued list first, before adding to available list.)
//
const bool bClawedBack = theNym.ClawbackTransactionNumber(theServerID, lClosingTransNo, false); // bSave=false
if (bClawedBack)
bNeedToSave = true;
// *************************************************************************
// Until I put this down here, there were subtle cases where the Nym wouldn't get saved.
// Therefore another vote for my "dirty instances" theory.
//
if (bSave && bNeedToSave)
{
OTPseudonym * pSignerNym = &theNym;// probably unnecessary.
theNym.SaveSignedNymfile(*pSignerNym);
}
}
示例2: onFinalReceipt
//.........这里部分代码省略.........
// 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.
{
OTString strNymID(ACTUAL_NYM_ID);
OTLog::vError("OTAgreement::onFinalReceipt: Failure loading public key for Nym: %s. "
"(To update his NymboxHash.) \n", strNymID.Get());
}
else if (theActualNym.VerifyPseudonym() && // this line may be unnecessary.
theActualNym.LoadSignedNymfile(*pServerNym)) // ServerNym here is not theActualNym's identity, but merely the signer on this file.
{
OTLog::Output(0, "OTAgreement::onFinalReceipt: Loading actual Nym, since he wasn't already loaded. "
"(To update his NymboxHash.)\n");
pActualNym = &theActualNym; // <=====
}
else
{