本文整理汇总了C++中ledger::pointer::getReserve方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::getReserve方法的具体用法?C++ pointer::getReserve怎么用?C++ pointer::getReserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::pointer
的用法示例。
在下文中一共展示了pointer::getReserve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isValid
bool PathRequest::isValid (RippleLineCache::ref crCache)
{
ScopedLockType sl (mLock);
bValid = raSrcAccount.isSet () && raDstAccount.isSet () && saDstAmount > zero;
Ledger::pointer lrLedger = crCache->getLedger ();
if (bValid)
{
AccountState::pointer asSrc = getApp().getOPs ().getAccountState (crCache->getLedger(), raSrcAccount);
if (!asSrc)
{
// no source account
bValid = false;
jvStatus = rpcError (rpcSRC_ACT_NOT_FOUND);
}
else
{
AccountState::pointer asDst = getApp().getOPs ().getAccountState (lrLedger, raDstAccount);
Json::Value& jvDestCur = (jvStatus["destination_currencies"] = Json::arrayValue);
if (!asDst)
{
// no destination account
jvDestCur.append (Json::Value ("XRP"));
if (!saDstAmount.isNative ())
{
// only XRP can be send to a non-existent account
bValid = false;
jvStatus = rpcError (rpcACT_NOT_FOUND);
}
else if (saDstAmount < STAmount (lrLedger->getReserve (0)))
{
// payment must meet reserve
bValid = false;
jvStatus = rpcError (rpcDST_AMT_MALFORMED);
}
}
else
{
bool const disallowXRP (
asDst->peekSLE ().getFlags() & lsfDisallowXRP);
CurrencySet usDestCurrID =
usAccountDestCurrencies (raDstAccount, crCache, !disallowXRP);
for (auto const& currency : usDestCurrID)
jvDestCur.append (to_string (currency));
jvStatus["destination_tag"] = (asDst->peekSLE ().getFlags () & lsfRequireDestTag) != 0;
}
}
}
if (bValid)
{
jvStatus["ledger_hash"] = to_string (lrLedger->getHash ());
jvStatus["ledger_index"] = lrLedger->getLedgerSeq ();
}
return bValid;
}