本文整理汇总了C++中ledger::pointer::isClosed方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::isClosed方法的具体用法?C++ pointer::isClosed怎么用?C++ pointer::isClosed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::pointer
的用法示例。
在下文中一共展示了pointer::isClosed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lookupLedger
// The previous version of the lookupLedger command would accept the
// "ledger_index" argument as a string and silently treat it as a request to
// return the current ledger which, while not strictly wrong, could cause a lot
// of confusion.
//
// The code now robustly validates the input and ensures that the only possible
// values for the "ledger_index" parameter are the index of a ledger passed as
// an integer or one of the strings "current", "closed" or "validated".
// Additionally, the code ensures that the value passed in "ledger_hash" is a
// string and a valid hash. Invalid values will return an appropriate error
// code.
//
// In the absence of the "ledger_hash" or "ledger_index" parameters, the code
// assumes that "ledger_index" has the value "current".
//
// Returns a Json::objectValue. If there was an error, it will be in that
// return value. Otherwise, the object contains the field "validated" and
// optionally the fields "ledger_hash", "ledger_index" and
// "ledger_current_index", if they are defined.
Status lookupLedger (
Json::Value const& params,
Ledger::pointer& ledger,
NetworkOPs& netOps,
Json::Value& jsonResult)
{
if (auto status = ledgerFromRequest (params, ledger, netOps))
return status;
if (ledger->isClosed ())
{
jsonResult[jss::ledger_hash] = to_string (ledger->getHash());
jsonResult[jss::ledger_index] = ledger->getLedgerSeq();
}
else
{
jsonResult[jss::ledger_current_index] = ledger->getLedgerSeq();
}
jsonResult[jss::validated] = isValidated (*ledger);
return Status::OK;
}