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


C++ ledger::ref类代码示例

本文整理汇总了C++中ledger::ref的典型用法代码示例。如果您正苦于以下问题:C++ ref类的具体用法?C++ ref怎么用?C++ ref使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ref类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
FeeVoteImpl::doValidation (Ledger::ref lastClosedLedger,
    STObject& baseValidation)
{
    if (lastClosedLedger->getBaseFee () != target_.reference_fee)
    {
        if (journal_.info) journal_.info <<
            "Voting for base fee of " << target_.reference_fee;

        baseValidation.setFieldU64 (sfBaseFee, target_.reference_fee);
    }

    if (lastClosedLedger->getReserve (0) != target_.account_reserve)
    {
        if (journal_.info) journal_.info <<
            "Voting for base resrve of " << target_.account_reserve;

        baseValidation.setFieldU32(sfReserveBase, target_.account_reserve);
    }

    if (lastClosedLedger->getReserveInc () != target_.owner_reserve)
    {
        if (journal_.info) journal_.info <<
            "Voting for reserve increment of " << target_.owner_reserve;

        baseValidation.setFieldU32 (sfReserveIncrement,
            target_.owner_reserve);
    }
}
开发者ID:xdv,项目名称:divvyd,代码行数:29,代码来源:FeeVoteImpl.cpp

示例2: validatedLedger

void LedgerHistory::validatedLedger (Ledger::ref ledger)
{
    LedgerIndex index = ledger->getLedgerSeq();
    LedgerHash hash = ledger->getHash();
    assert (!hash.isZero());
    ConsensusValidated::ScopedLockType sl (
        m_consensus_validated.peekMutex());

    std::shared_ptr< std::pair< LedgerHash, LedgerHash > > entry = std::make_shared<std::pair< LedgerHash, LedgerHash >>();
    m_consensus_validated.canonicalize(index, entry, false);

    if (entry->second != hash)
    {
        bool mismatch (false);

        if (entry->second.isNonZero() && (entry->second != hash))
        {
            WriteLog (lsERROR, LedgerMaster) << "MISMATCH: seq=" << index << " validated:" << entry->second << " then:" << hash;
            mismatch = true;
        }

        if (entry->first.isNonZero() && (entry->first != hash))
        {
            WriteLog (lsERROR, LedgerMaster) << "MISMATCH: seq=" << index << " built:" << entry->first << " validated:" << hash;
            mismatch = true;
        }

        if (mismatch)
            handleMismatch (entry->second, hash);

        entry->second = hash;
    }
}
开发者ID:619213152,项目名称:vpal20,代码行数:33,代码来源:LedgerHistory.cpp

示例3: amendmentSet

void
AmendmentTableImpl::doVoting (Ledger::ref lastClosedLedger,
    SHAMap::ref initialPosition)
{

    // LCL must be flag ledger
    assert((lastClosedLedger->getLedgerSeq () % 256) == 0);

    AmendmentSet amendmentSet (lastClosedLedger->getParentCloseTimeNC ());

    // get validations for ledger before flag ledger
    ValidationSet valSet = getApp().getValidations ().getValidations (lastClosedLedger->getParentHash ());
    for (auto const& entry : valSet)
    {
        auto const& val = *entry.second;

        if (val.isTrusted ())
        {
            amendmentSet.addVoter ();
            if (val.isFieldPresent (sfAmendments))
            {
                for (auto const& amendment : val.getFieldV256 (sfAmendments))
                {
                    amendmentSet.addVote (amendment);
                }
            }
        }
    }
    reportValidations (amendmentSet);

    amendmentList_t lAmendments = getToEnable (lastClosedLedger->getCloseTimeNC ());
    for (auto const& uAmendment : lAmendments)
    {
        if (m_journal.warning) m_journal.warning <<
            "Voting for amendment: " << uAmendment;

        // Create the transaction to enable the amendment
        STTx trans (ttAMENDMENT);
        trans.setFieldAccount (sfAccount, Account ());
        trans.setFieldH256 (sfAmendment, uAmendment);
        uint256 txID = trans.getTransactionID ();

        if (m_journal.warning) m_journal.warning <<
            "Vote ID: " << txID;

        // Inject the transaction into our initial proposal
        Serializer s;
        trans.add (s, true);
#if RIPPLE_PROPOSE_AMENDMENTS
        SHAMapItem::pointer tItem = std::make_shared<SHAMapItem> (txID, s.peekData ());
        if (!initialPosition->addGiveItem (tItem, true, false))
        {
            if (m_journal.warning) m_journal.warning <<
                "Ledger already had amendment transaction";
        }
#endif
    }
}
开发者ID:Xenland,项目名称:radard,代码行数:58,代码来源:AmendmentTableImpl.cpp

示例4: sit

AcceptedLedger::AcceptedLedger (Ledger::ref ledger) : mLedger (ledger)
{
    SHAMap& txSet = *ledger->peekTransactionMap ();

    for (SHAMapItem::pointer item = txSet.peekFirstItem (); !!item; item = txSet.peekNextItem (item->getTag ()))
    {
        SerializerIterator sit (item->peekSerializer ());
        insert (boost::make_shared<AcceptedLedgerTx> (ledger->getLedgerSeq (), boost::ref (sit)));
    }
}
开发者ID:Blizzard-,项目名称:rippled,代码行数:10,代码来源:AcceptedLedger.cpp

示例5: makeAcceptedLedger

AcceptedLedger::pointer AcceptedLedger::makeAcceptedLedger (Ledger::ref ledger)
{
    AcceptedLedger::pointer ret = s_cache.fetch (ledger->getHash ());

    if (ret)
        return ret;

    ret = AcceptedLedger::pointer (new AcceptedLedger (ledger));
    s_cache.canonicalize (ledger->getHash (), ret);
    return ret;
}
开发者ID:Blizzard-,项目名称:rippled,代码行数:11,代码来源:AcceptedLedger.cpp

示例6: fillItems

void AccountItems::fillItems (const uint160& accountID, Ledger::ref ledger)
{
    uint256 const rootIndex = Ledger::getOwnerDirIndex (accountID);
    uint256 currentIndex    = rootIndex;

    // VFALCO TODO Rewrite all infinite loops to have clear terminating
    //             conditions defined in one location.
    //
    while (1)
    {
        SLE::pointer ownerDir   = ledger->getDirNode (currentIndex);

        // VFALCO TODO Rewrite to not return from the middle of the function
        if (!ownerDir)
            return;

        BOOST_FOREACH (uint256 const & uNode, ownerDir->getFieldV256 (sfIndexes).peekValue ())
        {
            // VFALCO TODO rename getSLEi() to something legible.
            SLE::pointer sleCur = ledger->getSLEi (uNode);

            if (!sleCur)
            {
                // item in directory not in ledger
            }
            else
            {
                AccountItem::pointer item = mOfType->makeItem (accountID, sleCur);

                // VFALCO NOTE Under what conditions would makeItem() return nullptr?
                // DJS NOTE If the item wasn't one this particular AccountItems was interested in
                // (For example, if the owner is only interested in ripple lines and this is an offer)
                if (item)
                {
                    mItems.push_back (item);
                }
            }
        }

        std::uint64_t uNodeNext    = ownerDir->getFieldU64 (sfIndexNext);

        // VFALCO TODO Rewrite to not return from the middle of the function
        if (!uNodeNext)
            return;

        currentIndex = Ledger::getDirNodeIndex (rootIndex, uNodeNext);
    }
}
开发者ID:BattleProgrammer,项目名称:stellard,代码行数:48,代码来源:AccountItems.cpp

示例7: setup

void OrderBookDB::setup (Ledger::ref ledger)
{
    {
        ScopedLockType sl (mLock);
        auto seq = ledger->getLedgerSeq ();

        // Do a full update every 256 ledgers
        if (mSeq != 0)
        {
            if (seq == mSeq)
                return;
            if ((seq > mSeq) && ((seq - mSeq) < 256))
                return;
            if ((seq < mSeq) && ((mSeq - seq) < 16))
                return;
        }

        WriteLog (lsDEBUG, OrderBookDB)
            << "Advancing from " << mSeq << " to " << seq;

        mSeq = seq;
    }

    if (getConfig().RUN_STANDALONE)
        update(ledger);
    else
        getApp().getJobQueue().addJob(jtUPDATE_PF, "OrderBookDB::update",
            std::bind(&OrderBookDB::update, this, ledger));
}
开发者ID:xdv,项目名称:divvyd,代码行数:29,代码来源:OrderBookDB.cpp

示例8: switchLedgers

void LedgerMaster::switchLedgers(Ledger::ref lastClosed, Ledger::ref current)
{
	assert(lastClosed && current);

	{
		boost::recursive_mutex::scoped_lock ml(mLock);
		mFinalizedLedger = lastClosed;
		mFinalizedLedger->setClosed();
		mFinalizedLedger->setAccepted();
		mCurrentLedger = current;
	}

	assert(!mCurrentLedger->isClosed());
	mEngine.setLedger(mCurrentLedger);
	checkAccept(lastClosed->getHash(), lastClosed->getLedgerSeq());
}
开发者ID:Criptomonedas,项目名称:rippled,代码行数:16,代码来源:LedgerMaster.cpp

示例9: doapplyvalidation

 void doapplyvalidation(ledger::ref lastclosedledger, stobject& basevalidation) override
 {
     dividendmaster::pointer dividendmaster = getapp().getops().getdividendmaster();
     if (dividendmaster->trylock())
     {
         if (dividendmaster->isready())
         {
             uint32_t dividendledger = lastclosedledger->getdividendbaseledger();
             if (dividendledger == dividendmaster->getledgerseq())
             {
                 basevalidation.setfieldu32 (sfdividendledger, dividendledger);
                 basevalidation.setfieldh256 (sfdividendresulthash, dividendmaster->getresulthash());
                 
                 if (m_journal.info)
                     m_journal.info << "voting for a dividend apply based " << dividendledger << " with hash "<< dividendmaster->getresulthash() << " in " << lastclosedledger->gethash();
             }
             else
             {
                 if (m_journal.warning)
                     m_journal.warning << "wrong base ledger " << dividendmaster->getledgerseq() << " want "<< dividendledger;
             }
         }
         dividendmaster->unlock();
     }
 }
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:25,代码来源:DividendVoteImpl.cpp

示例10: setup

void OrderBookDB::setup (Ledger::ref ledger)
{
    {
        ScopedLockType sl (mLock, __FILE__, __LINE__);

        // Do a full update every 256 ledgers
        if (mSeq != 0)
        {
            if (ledger->getLedgerSeq () == mSeq)
                return;
            if ((ledger->getLedgerSeq () > mSeq) && ((ledger->getLedgerSeq () - mSeq) < 256))
                return;
            if ((ledger->getLedgerSeq () < mSeq) && ((mSeq - ledger->getLedgerSeq ()) < 16))
                return;
        }

        WriteLog (lsDEBUG, OrderBookDB) << "Advancing from " << mSeq << " to " << ledger->getLedgerSeq();

        mSeq = ledger->getLedgerSeq ();
    }

    if (getConfig().RUN_STANDALONE)
        update(ledger);
    else
        getApp().getJobQueue().addJob(jtUPDATE_PF, "OrderBookDB::update",
            BIND_TYPE(&OrderBookDB::update, this, ledger));
}
开发者ID:DaiLiRong,项目名称:rippled,代码行数:27,代码来源:OrderBookDB.cpp

示例11: fillItems

void AccountItems::fillItems (Account const& accountID, Ledger::ref ledger)
{
    uint256 const rootIndex = Ledger::getOwnerDirIndex (accountID);
    uint256 currentIndex    = rootIndex;

    // VFALCO TODO Rewrite all infinite loops to have clear terminating
    //             conditions defined in one location.
    //
    while (1)
    {
        SLE::pointer ownerDir   = ledger->getDirNode (currentIndex);

        // VFALCO TODO Rewrite to not return from the middle of the function
        if (!ownerDir)
            return;

        for (auto const& uNode: ownerDir->getFieldV256 (sfIndexes).peekValue ())
        {
            // VFALCO TODO rename getSLEi() to something legible.
            SLE::pointer sleCur = ledger->getSLEi (uNode);

            if (sleCur)
            {
                // The item in the directory is in ledger
                auto item = mOfType->makeItem (accountID, sleCur);

                // makeItem() returns nullptr if the item wasn't one this
                // particular AccountItems was interested in - for example, if
                // the owner is only interested in ripple lines and this is an
                // offer.
                if (item)
                    mItems.push_back (item);
            }
        }

        std::uint64_t uNodeNext    = ownerDir->getFieldU64 (sfIndexNext);

        if (!uNodeNext)
            return;

        currentIndex = Ledger::getDirNodeIndex (rootIndex, uNodeNext);
    }
}
开发者ID:RagnarDanneskjold,项目名称:rippled,代码行数:43,代码来源:AccountItems.cpp

示例12: acquireMissingLedger

bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& ledgerHash, uint32 ledgerSeq)
{ // return: false = already gave up recently
	if (mTooFast)
		return true;

	Ledger::pointer ledger = mLedgerHistory.getLedgerBySeq(ledgerSeq);
	if (ledger && (Ledger::getHashByIndex(ledgerSeq) == ledgerHash))
	{
		cLog(lsTRACE) << "Ledger hash found in database";
		mTooFast = true;
		theApp->getJobQueue().addJob(jtPUBOLDLEDGER, boost::bind(&LedgerMaster::asyncAccept, this, ledger));
		return true;
	}

	if (theApp->getMasterLedgerAcquire().isFailure(ledgerHash))
		return false;

	mMissingLedger = theApp->getMasterLedgerAcquire().findCreate(ledgerHash);
	if (mMissingLedger->isComplete())
	{
		Ledger::pointer lgr = mMissingLedger->getLedger();
		if (lgr && (lgr->getLedgerSeq() == ledgerSeq))
			missingAcquireComplete(mMissingLedger);
		mMissingLedger.reset();
		return true;
	}
	else if (mMissingLedger->isDone())
	{
		mMissingLedger.reset();
		return false;
	}
	mMissingSeq = ledgerSeq;
	if (mMissingLedger->setAccept())
	{
		if (!mMissingLedger->addOnComplete(boost::bind(&LedgerMaster::missingAcquireComplete, this, _1)))
			theApp->getIOService().post(boost::bind(&LedgerMaster::missingAcquireComplete, this, mMissingLedger));
	}

	int fetch = theConfig.getSize(siLedgerFetch);
	if (theApp->getMasterLedgerAcquire().getFetchCount() < fetch)
	{
		int count = 0;
		typedef std::pair<uint32, uint256> u_pair;

		std::vector<u_pair> vec = origLedger->getLedgerHashes();
		BOOST_REVERSE_FOREACH(const u_pair& it, vec)
		{
			if ((count < fetch) && (it.first < ledgerSeq) &&
				!mCompleteLedgers.hasValue(it.first) && !theApp->getMasterLedgerAcquire().find(it.second))
			{
				++count;
				theApp->getMasterLedgerAcquire().findCreate(it.second);
			}
		}
	}
开发者ID:Criptomonedas,项目名称:rippled,代码行数:55,代码来源:LedgerMaster.cpp

示例13: pushLedger

void LedgerMaster::pushLedger(Ledger::ref newLCL, Ledger::ref newOL, bool fromConsensus)
{
	assert(newLCL->isClosed() && newLCL->isAccepted());
	assert(!newOL->isClosed() && !newOL->isAccepted());

	if (newLCL->isAccepted())
	{
		assert(newLCL->isClosed());
		assert(newLCL->isImmutable());
		mLedgerHistory.addAcceptedLedger(newLCL, fromConsensus);
		cLog(lsINFO) << "StashAccepted: " << newLCL->getHash();
	}

	{
		boost::recursive_mutex::scoped_lock ml(mLock);
		mFinalizedLedger = newLCL;
		mCurrentLedger = newOL;
		mEngine.setLedger(newOL);
	}
	checkAccept(newLCL->getHash(), newLCL->getLedgerSeq());
}
开发者ID:Criptomonedas,项目名称:rippled,代码行数:21,代码来源:LedgerMaster.cpp

示例14: isstartledger

 bool isstartledger(ledger::ref ledger) override
 {
     return ((ledger->getledgerseq() > 2) &&
             (ledger->gettotalcoins() < vrp_increase_max || ledger->gettotalcoinsvbc() < vbc_increase_max) &&
             (ledger->getclosetime().time_of_day().hours() == 1) &&
             ((ledger->getclosetimenc() - ledger->getdividendtimenc()) > 3600)
             );
 }
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:8,代码来源:DividendVoteImpl.cpp

示例15: validatedLedger

void LedgerHistory::validatedLedger (Ledger::ref ledger)
{
    LedgerIndex index = ledger->getLedgerSeq();
    LedgerHash hash = ledger->getHash();
    assert (!hash.isZero());
    TaggedCache::ScopedLockType sl(mConsensusValidated.peekMutex(), __FILE__, __LINE__);

    boost::shared_ptr< std::pair< LedgerHash, LedgerHash > > entry = boost::make_shared<std::pair< LedgerHash, LedgerHash >>();
    mConsensusValidated.canonicalize(index, entry, false);

    if (entry->second != hash)
    {
        if (entry->second.isNonZero() && (entry->second != hash))
        {
            WriteLog (lsERROR, LedgerMaster) << "MISMATCH: seq=" << index << " validated:" << entry->second << " then:" << hash;
        }
        if (entry->first.isNonZero() && (entry->first != hash))
        {
            WriteLog (lsERROR, LedgerMaster) << "MISMATCH: seq=" << index << " built:" << entry->first << " validated:" << hash;
        }
        entry->second = hash;
    }
}
开发者ID:Aiolossong,项目名称:rippled,代码行数:23,代码来源:LedgerHistory.cpp


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