static void addOrSubtractLiabilities( std::map<AccountID, std::map<Asset, Liabilities>>& deltaLiabilities, std::shared_ptr<LedgerEntry const> const& entry, bool isAdd) { if (!entry) { return; } int64_t sign = isAdd ? 1 : -1; if (entry->data.type() == ACCOUNT) { auto const& account = entry->data.account(); Asset native(ASSET_TYPE_NATIVE); deltaLiabilities[account.accountID][native].selling -= sign * getSellingLiabilities(*entry); deltaLiabilities[account.accountID][native].buying -= sign * getBuyingLiabilities(*entry); } else if (entry->data.type() == TRUSTLINE) { auto const& trust = entry->data.trustLine(); deltaLiabilities[trust.accountID][trust.asset].selling -= sign * getSellingLiabilities(*entry); deltaLiabilities[trust.accountID][trust.asset].buying -= sign * getBuyingLiabilities(*entry); } else if (entry->data.type() == OFFER) { auto const& offer = entry->data.offer(); if (offer.selling.type() == ASSET_TYPE_NATIVE || !(getIssuer(offer.selling) == offer.sellerID)) { deltaLiabilities[offer.sellerID][offer.selling].selling += sign * getOfferSellingLiabilities(*entry); } if (offer.buying.type() == ASSET_TYPE_NATIVE || !(getIssuer(offer.buying) == offer.sellerID)) { deltaLiabilities[offer.sellerID][offer.buying].buying += sign * getOfferBuyingLiabilities(*entry); } } }
CByteArray APL_Certif::getOCSPResponse() { CByteArray response; APL_Certif *issuer=NULL; if(isRoot()) issuer=this; else issuer=getIssuer(); if(issuer==NULL) return response; if(m_cryptoFwk->GetOCSPResponse(getData(), issuer->getData(), &response)) return response; return response; }
TER SetTrust::preclaim(PreclaimContext const& ctx) { auto const id = ctx.tx[sfAccount]; auto const sle = ctx.view.read( keylet::account(id)); std::uint32_t const uTxFlags = ctx.tx.getFlags(); bool const bSetAuth = (uTxFlags & tfSetfAuth); if (bSetAuth && !(sle->getFieldU32(sfFlags) & lsfRequireAuth)) { JLOG(ctx.j.trace) << "Retry: Auth not required."; return tefNO_AUTH_REQUIRED; } auto const saLimitAmount = ctx.tx[sfLimitAmount]; auto const currency = saLimitAmount.getCurrency(); auto const uDstAccountID = saLimitAmount.getIssuer(); if (id == uDstAccountID) { // Prevent trustline to self from being created, // unless one has somehow already been created // (in which case doApply will clean it up). auto const sleDelete = ctx.view.read( keylet::line(id, uDstAccountID, currency)); if (!sleDelete) { JLOG(ctx.j.trace) << "Malformed transaction: Can not extend credit to self."; return temDST_IS_SRC; } } return tesSUCCESS; }
QVariant pki_crl::column_data(dbheader *hd) { switch (hd->id) { case HD_crl_signer: if (issuer) return QVariant(getIssuer()->getIntName()); else return QVariant(tr("unknown")); case HD_crl_revoked: return QVariant(numRev()); case HD_crl_lastUpdate: return QVariant(getLastUpdate().toSortable()); case HD_crl_nextUpdate: return QVariant(getNextUpdate().toSortable()); case HD_crl_crlnumber: a1int a; if (getCrlNumber(&a)) return QVariant(a.toDec()); return QVariant(); } return pki_x509name::column_data(hd); }