本文整理汇总了C++中accountframe::pointer::storeAdd方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::storeAdd方法的具体用法?C++ pointer::storeAdd怎么用?C++ pointer::storeAdd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类accountframe::pointer
的用法示例。
在下文中一共展示了pointer::storeAdd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: innerResult
bool
CreateAccountOpFrame::doApply(medida::MetricsRegistry& metrics,
LedgerDelta& delta, LedgerManager& ledgerManager)
{
AccountFrame::pointer destAccount;
Database& db = ledgerManager.getDatabase();
destAccount = AccountFrame::loadAccount(mCreateAccount.destination, db);
if (!destAccount)
{
if (mCreateAccount.startingBalance < ledgerManager.getMinBalance(0))
{ // not over the minBalance to make an account
metrics.NewMeter({"op-create-account", "failure", "low-reserve"},
"operation").Mark();
innerResult().code(CREATE_ACCOUNT_LOW_RESERVE);
return false;
}
else
{
int64_t minBalance =
mSourceAccount->getMinimumBalance(ledgerManager);
if (mSourceAccount->getAccount().balance <
(minBalance + mCreateAccount.startingBalance))
{ // they don't have enough to send
metrics.NewMeter({"op-create-account", "failure", "underfunded"},
"operation").Mark();
innerResult().code(CREATE_ACCOUNT_UNDERFUNDED);
return false;
}
mSourceAccount->getAccount().balance -=
mCreateAccount.startingBalance;
mSourceAccount->storeChange(delta, db);
destAccount = make_shared<AccountFrame>(mCreateAccount.destination);
destAccount->getAccount().seqNum =
delta.getHeaderFrame().getStartingSequenceNumber();
destAccount->getAccount().balance = mCreateAccount.startingBalance;
destAccount->storeAdd(delta, db);
metrics.NewMeter({"op-create-account", "success", "apply"},
"operation").Mark();
innerResult().code(CREATE_ACCOUNT_SUCCESS);
return true;
}
}
else
{
metrics.NewMeter({"op-create-account", "failure", "already-exist"},
"operation").Mark();
innerResult().code(CREATE_ACCOUNT_ALREADY_EXIST);
return false;
}
}