// 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. // IF theNym is the original sender, the opening number will be harvested // inside this call. // OTCronItem::HarvestOpeningNumber(theNym); // The Nym is the original recipient. (If Compares true). // IN CASES where GetTransactionNum() isn't already burned, we can harvest it here. // if (theNym.CompareID(GetRecipientUserID())) { // 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.) // theNym.ClawbackTransactionNumber(GetServerID(), GetRecipientOpeningNum(), true); //bSave=true } // NOTE: if the message failed (transaction never actually ran) then the sender AND recipient // can both reclaim their opening numbers. But if the message SUCCEEDED and the transaction FAILED, // then only the recipient can claim his opening number -- the sender's is already burned. So then, // what if you mistakenly call this function and pass the sender, when that number is already burned? // There's nothing this function can do, because we have no way of telling, from inside here, // whether the message succeeded or not, and whether the transaction succeeded or not. Therefore, // ==> we MUST rely on the CALLER to know this, and to avoid calling this function in the first place, // if he's sitting on a sender with a failed transaction. }
bool OTAgreement::IsValidOpeningNumber(const long & lOpeningNum) const { if (GetRecipientOpeningNum() == lOpeningNum) return true; return OTCronItem::IsValidOpeningNumber(lOpeningNum); }
long OTAgreement::GetOpeningNumber(const OTIdentifier & theNymID) const { const OTIdentifier & theRecipientNymID = this->GetRecipientUserID(); if (theNymID == theRecipientNymID) return GetRecipientOpeningNum(); // else... return OTCronItem::GetOpeningNumber(theNymID); }
// 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 } }