本文整理汇总了C++中ledger::pointer::getledgerseq方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::getledgerseq方法的具体用法?C++ pointer::getledgerseq怎么用?C++ pointer::getledgerseq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::pointer
的用法示例。
在下文中一共展示了pointer::getledgerseq方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getledgerhash
ledgerhash getledgerhash(ledger::pointer ledger, ledgerindex index)
{
ledgerhash hash;
try
{
hash = ledger->getledgerhash(index);
}
catch (shamapmissingnode &)
{
m_journal.warning <<
"node missing from ledger " << ledger->getledgerseq();
getapp().getinboundledgers().findcreate (
ledger->gethash(), ledger->getledgerseq(), inboundledger::fcgeneric);
}
return hash;
}
示例2: gethash
/** returns the hash of the specified ledger.
@param ledgerindex the index of the desired ledger.
@param referenceledger [out] an optional known good subsequent ledger.
@return the hash of the ledger. this will be all-bits-zero if not found.
*/
ledgerhash gethash(
ledgerindex const& ledgerindex,
ledger::pointer& referenceledger)
{
ledgerhash ledgerhash;
if (!referenceledger || (referenceledger->getledgerseq() < ledgerindex))
{
referenceledger = getapp().getledgermaster().getvalidatedledger();
if (!referenceledger)
{
m_journal.warning << "no validated ledger";
return ledgerhash; // nothing we can do. no validated ledger.
}
}
if (referenceledger->getledgerseq() >= ledgerindex)
{
// see if the hash for the ledger we need is in the reference ledger
ledgerhash = getledgerhash(referenceledger, ledgerindex);
if (ledgerhash.iszero())
{
// no, try to get another ledger that might have the hash we need
// compute the index and hash of a ledger that will have the hash we need
ledgerindex refindex = (ledgerindex + 255) & (~255);
ledgerhash refhash = getledgerhash (referenceledger, refindex);
bool const nonzero (refhash.isnonzero ());
assert (nonzero);
if (nonzero)
{
// we found the hash and sequence of a better reference ledger
referenceledger = getapp().getledgermaster().findacquireledger (refindex, refhash);
if (referenceledger)
ledgerhash = getledgerhash(referenceledger, ledgerindex);
}
}
}
else
m_journal.warning << "validated ledger is prior to target ledger";
return ledgerhash;
}