本文整理汇总了C++中sle::pointer::getAccountID方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::getAccountID方法的具体用法?C++ pointer::getAccountID怎么用?C++ pointer::getAccountID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sle::pointer
的用法示例。
在下文中一共展示了pointer::getAccountID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: view
TER
CancelTicket::doApply ()
{
uint256 const ticketId = ctx_.tx.getFieldH256 (sfTicketID);
// VFALCO This is highly suspicious, we're requiring that the
// transaction provide the return value of getTicketIndex?
SLE::pointer sleTicket = view().peek (keylet::ticket(ticketId));
if (!sleTicket)
return tecNO_ENTRY;
auto const ticket_owner =
sleTicket->getAccountID (sfAccount);
bool authorized =
account_ == ticket_owner;
// The target can also always remove a ticket
if (!authorized && sleTicket->isFieldPresent (sfTarget))
authorized = (account_ == sleTicket->getAccountID (sfTarget));
// And finally, anyone can remove an expired ticket
if (!authorized && sleTicket->isFieldPresent (sfExpiration))
{
using tp = NetClock::time_point;
using d = tp::duration;
auto const expiration = tp{d{sleTicket->getFieldU32(sfExpiration)}};
if (view().parentCloseTime() >= expiration)
authorized = true;
}
if (!authorized)
return tecNO_PERMISSION;
std::uint64_t const hint (sleTicket->getFieldU64 (sfOwnerNode));
if (! ctx_.view().dirRemove(
keylet::ownerDir(ticket_owner), hint, ticketId, false))
{
return tefBAD_LEDGER;
}
auto viewJ = ctx_.app.journal ("View");
adjustOwnerCount(view(), view().peek(
keylet::account(ticket_owner)), -1, viewJ);
ctx_.view ().erase (sleTicket);
return tesSUCCESS;
}