本文整理汇总了C++中ledger::ref::getHash方法的典型用法代码示例。如果您正苦于以下问题:C++ ref::getHash方法的具体用法?C++ ref::getHash怎么用?C++ ref::getHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::ref
的用法示例。
在下文中一共展示了ref::getHash方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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;
}
}
示例3: 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());
}
示例4: 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());
}
示例5: 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;
}
}