当前位置: 首页>>代码示例>>C++>>正文


C++ pointer::getledgerseq方法代码示例

本文整理汇总了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;
 }
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:16,代码来源:LedgerCleaner.cpp

示例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;
    }
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:48,代码来源:LedgerCleaner.cpp


注:本文中的ledger::pointer::getledgerseq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。