本文整理汇总了C++中JLOG函数的典型用法代码示例。如果您正苦于以下问题:C++ JLOG函数的具体用法?C++ JLOG怎么用?C++ JLOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JLOG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: terminateHandler
void terminateHandler()
{
if (std::current_exception())
{
std::string const name = threadName.get() ? *threadName.get() : "Unknown";
try
{
throw;
}
catch (const std::exception& e)
{
std::cerr << name << ": " << e.what () << '\n';
JLOG(debugLog().fatal())
<< name << ": " << e.what () << '\n';
}
catch (boost::coroutines::detail::forced_unwind const&)
{
std::cerr << name << ": forced_unwind\n";
JLOG(debugLog().fatal())
<< name << ": forced_unwind\n";
}
catch (...)
{
std::cerr << name << ": unknown exception\n";
JLOG (debugLog ().fatal ())
<< name << ": unknown exception\n";
}
}
}
开发者ID:bachase,项目名称:rippled,代码行数:29,代码来源:ThreadEntry.cpp
示例2: doCommand
Status doCommand (
RPC::Context& context, Json::Value& result)
{
Handler const * handler = nullptr;
if (auto error = fillHandler (context, handler))
{
inject_error (error, result);
return error;
}
if (auto method = handler->valueMethod_)
{
if (! context.headers.user.empty() ||
! context.headers.forwardedFor.empty())
{
JLOG(context.j.debug()) << "start command: " << handler->name_ <<
", X-User: " << context.headers.user << ", X-Forwarded-For: " <<
context.headers.forwardedFor;
auto ret = callMethod (context, method, handler->name_, result);
JLOG(context.j.debug()) << "finish command: " << handler->name_ <<
", X-User: " << context.headers.user << ", X-Forwarded-For: " <<
context.headers.forwardedFor;
return ret;
}
else
{
return callMethod (context, method, handler->name_, result);
}
}
return rpcUNKNOWN_COMMAND;
}
开发者ID:dreamsxin,项目名称:rippled,代码行数:35,代码来源:RPCHandler.cpp
示例3: count
// Checks the cache size and prunes if its over the limit.
void
Bootcache::prune ()
{
if (size() <= Tuning::bootcacheSize)
return;
// Calculate the amount to remove
auto count ((size() *
Tuning::bootcachePrunePercent) / 100);
decltype(count) pruned (0);
// Work backwards because bimap doesn't handle
// erasing using a reverse iterator very well.
//
for (auto iter (m_map.right.end());
count-- > 0 && iter != m_map.right.begin(); ++pruned)
{
--iter;
beast::IP::Endpoint const& endpoint (iter->get_left());
Entry const& entry (iter->get_right());
JLOG(m_journal.trace()) << beast::leftw (18) <<
"Bootcache pruned" << endpoint <<
" at valence " << entry.valence();
iter = m_map.right.erase (iter);
}
JLOG(m_journal.debug()) << beast::leftw (18) <<
"Bootcache pruned " << pruned << " entries total";
}
开发者ID:dreamsxin,项目名称:rippled,代码行数:30,代码来源:Bootcache.cpp
示例4: preflight1
/** Performs early sanity checks on the account and fee fields */
NotTEC
preflight1 (PreflightContext const& ctx)
{
auto const ret = preflight0(ctx);
if (!isTesSuccess(ret))
return ret;
auto const id = ctx.tx.getAccountID(sfAccount);
if (id == beast::zero)
{
JLOG(ctx.j.warn()) << "preflight1: bad account id";
return temBAD_SRC_ACCOUNT;
}
// No point in going any further if the transaction fee is malformed.
auto const fee = ctx.tx.getFieldAmount (sfFee);
if (!fee.native () || fee.negative () || !isLegalAmount (fee.xrp ()))
{
JLOG(ctx.j.debug()) << "preflight1: invalid fee";
return temBAD_FEE;
}
auto const spk = ctx.tx.getSigningPubKey();
if (!spk.empty () && !publicKeyType (makeSlice (spk)))
{
JLOG(ctx.j.debug()) << "preflight1: invalid signing key";
return temBAD_SIGNATURE;
}
return tesSUCCESS;
}
开发者ID:Empresaria,项目名称:rippled,代码行数:33,代码来源:Transactor.cpp
示例5: preflight1
TER
CancelOffer::preflight (PreflightContext const& ctx)
{
auto const ret = preflight1 (ctx);
if (!isTesSuccess (ret))
return ret;
auto const uTxFlags = ctx.tx.getFlags();
if (uTxFlags & tfUniversalMask)
{
JLOG(ctx.j.trace) << "Malformed transaction: " <<
"Invalid flags set.";
return temINVALID_FLAG;
}
auto const seq = ctx.tx.getFieldU32 (sfOfferSequence);
if (! seq)
{
JLOG(ctx.j.trace) <<
"CancelOffer::preflight: missing sequence";
return temBAD_SEQUENCE;
}
return preflight2(ctx);
}
开发者ID:alexandrev,项目名称:rippled,代码行数:26,代码来源:CancelOffer.cpp
示例6: sociRawData
void
ManifestCache::load (
DatabaseCon& dbCon, std::string const& dbTable)
{
// Load manifests stored in database
std::string const sql =
"SELECT RawData FROM " + dbTable + ";";
auto db = dbCon.checkoutDb ();
soci::blob sociRawData (*db);
soci::statement st =
(db->prepare << sql,
soci::into (sociRawData));
st.execute ();
while (st.fetch ())
{
std::string serialized;
convert (sociRawData, serialized);
if (auto mo = Manifest::make_Manifest (std::move (serialized)))
{
if (!mo->verify())
{
JLOG(j_.warn())
<< "Unverifiable manifest in db";
continue;
}
applyManifest (std::move(*mo));
}
else
{
JLOG(j_.warn())
<< "Malformed manifest in database";
}
}
}
开发者ID:dreamsxin,项目名称:rippled,代码行数:35,代码来源:Manifest.cpp
示例7: clear
void
Bootcache::load ()
{
clear();
auto const n (m_store.load (
[this](beast::IP::Endpoint const& endpoint, int valence)
{
auto const result (this->m_map.insert (
value_type (endpoint, valence)));
if (! result.second)
{
JLOG(this->m_journal.error())
<< beast::leftw (18) <<
"Bootcache discard " << endpoint;
}
}));
if (n > 0)
{
JLOG(m_journal.info()) << beast::leftw (18) <<
"Bootcache loaded " << n <<
((n > 1) ? " addresses" : " address");
prune ();
}
}
开发者ID:dreamsxin,项目名称:rippled,代码行数:25,代码来源:Bootcache.cpp
示例8: doApply
std::pair<TER, bool>
doApply(PreclaimResult const& preclaimResult,
Application& app, OpenView& view)
{
if (preclaimResult.view.seq() != view.seq())
{
// Logic error from the caller. Don't have enough
// info to recover.
return{ tefEXCEPTION, false };
}
try
{
if (!preclaimResult.likelyToClaimFee)
return{ preclaimResult.ter, false };
ApplyContext ctx(app, view,
preclaimResult.tx, preclaimResult.ter,
preclaimResult.baseFee, preclaimResult.flags,
preclaimResult.j);
if (view.txExists (ctx.tx.getTransactionID ()))
{
JLOG (preclaimResult.j.warning) << "transaction duplicates!";
return {tefALREADY, false};
}
return invoke_apply(ctx);
}
catch (std::exception const& e)
{
JLOG(preclaimResult.j.fatal) <<
"apply: " << e.what();
return { tefEXCEPTION, false };
}
}
开发者ID:hepengyuan520,项目名称:CFQuantumd,代码行数:32,代码来源:applySteps.cpp
示例9: JLOG
TER PathCursor::liquidity () const
{
TER resultCode = tecPATH_DRY;
PathCursor pc = *this;
pathState_.resetView (rippleCalc_.view);
for (pc.nodeIndex_ = pc.nodeSize(); pc.nodeIndex_--; )
{
JLOG (j_.trace())
<< "reverseLiquidity>"
<< " nodeIndex=" << pc.nodeIndex_
<< ".issue_.account=" << to_string (pc.node().issue_.account);
resultCode = pc.reverseLiquidity();
if (!pc.node().transferRate_)
return tefINTERNAL;
JLOG (j_.trace())
<< "reverseLiquidity< "
<< "nodeIndex=" << pc.nodeIndex_
<< " resultCode=" << transToken (resultCode)
<< " transferRate_=" << *pc.node().transferRate_
<< ": " << resultCode;
if (resultCode != tesSUCCESS)
break;
}
// VFALCO-FIXME this generates errors
// JLOG (j_.trace())
// << "nextIncrement: Path after reverse: " << pathState_.getJson ();
if (resultCode != tesSUCCESS)
return resultCode;
pathState_.resetView (rippleCalc_.view);
for (pc.nodeIndex_ = 0; pc.nodeIndex_ < pc.nodeSize(); ++pc.nodeIndex_)
{
JLOG (j_.trace())
<< "forwardLiquidity> nodeIndex=" << nodeIndex_;
resultCode = pc.forwardLiquidity();
if (resultCode != tesSUCCESS)
return resultCode;
JLOG (j_.trace())
<< "forwardLiquidity<"
<< " nodeIndex:" << pc.nodeIndex_
<< " resultCode:" << resultCode;
if (pathState_.isDry())
resultCode = tecPATH_DRY;
}
return resultCode;
}
开发者ID:bachase,项目名称:rippled,代码行数:58,代码来源:Liquidity.cpp
示例10: preflight1
TER
SetTrust::preflight (PreflightContext const& ctx)
{
auto const ret = preflight1 (ctx);
if (!isTesSuccess (ret))
return ret;
auto& tx = ctx.tx;
auto& j = ctx.j;
std::uint32_t const uTxFlags = tx.getFlags ();
if (uTxFlags & tfTrustSetMask)
{
JLOG(j.trace) <<
"Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
STAmount const saLimitAmount (tx.getFieldAmount (sfLimitAmount));
if (!isLegalNet (saLimitAmount))
return temBAD_AMOUNT;
if (saLimitAmount.native ())
{
JLOG(j.trace) <<
"Malformed transaction: specifies native limit " <<
saLimitAmount.getFullText ();
return temBAD_LIMIT;
}
if (badCurrency() == saLimitAmount.getCurrency ())
{
JLOG(j.trace) <<
"Malformed transaction: specifies XRP as IOU";
return temBAD_CURRENCY;
}
if (saLimitAmount < zero)
{
JLOG(j.trace) <<
"Malformed transaction: Negative credit limit.";
return temBAD_LIMIT;
}
// Check if destination makes sense.
auto const& issuer = saLimitAmount.getIssuer ();
if (!issuer || issuer == noAccount())
{
JLOG(j.trace) <<
"Malformed transaction: no destination account.";
return temDST_NEEDED;
}
return preflight2 (ctx);
}
开发者ID:alexandrev,项目名称:rippled,代码行数:58,代码来源:SetTrust.cpp
示例11: load
bool
ManifestCache::load (
DatabaseCon& dbCon, std::string const& dbTable,
std::string const& configManifest,
std::vector<std::string> const& configRevocation)
{
load (dbCon, dbTable);
if (! configManifest.empty())
{
auto mo = Manifest::make_Manifest (
beast::detail::base64_decode(configManifest));
if (! mo)
{
JLOG (j_.error()) << "Malformed validator_token in config";
return false;
}
if (mo->revoked())
{
JLOG (j_.warn()) <<
"Configured manifest revokes public key";
}
if (applyManifest (std::move(*mo)) ==
ManifestDisposition::invalid)
{
JLOG (j_.error()) << "Manifest in config was rejected";
return false;
}
}
if (! configRevocation.empty())
{
std::string revocationStr;
revocationStr.reserve (
std::accumulate (configRevocation.cbegin(), configRevocation.cend(), std::size_t(0),
[] (std::size_t init, std::string const& s)
{
return init + s.size();
}));
for (auto const& line : configRevocation)
revocationStr += beast::rfc2616::trim(line);
auto mo = Manifest::make_Manifest (
beast::detail::base64_decode(revocationStr));
if (! mo || ! mo->revoked() ||
applyManifest (std::move(*mo)) == ManifestDisposition::invalid)
{
JLOG (j_.error()) << "Invalid validator key revocation in config";
return false;
}
}
return true;
}
开发者ID:dreamsxin,项目名称:rippled,代码行数:58,代码来源:Manifest.cpp
示例12: JLOG
TER
SetSignerList::validateQuorumAndSignerEntries (
std::uint32_t quorum,
std::vector<SignerEntries::SignerEntry> const& signers,
AccountID const& account,
beast::Journal j)
{
// Reject if there are too many or too few entries in the list.
{
std::size_t const signerCount = signers.size ();
if ((signerCount < STTx::minMultiSigners)
|| (signerCount > STTx::maxMultiSigners))
{
JLOG(j.trace) << "Too many or too few signers in signer list.";
return temMALFORMED;
}
}
// Make sure there are no duplicate signers.
assert(std::is_sorted(signers.begin(), signers.end()));
if (std::adjacent_find (
signers.begin (), signers.end ()) != signers.end ())
{
JLOG(j.trace) << "Duplicate signers in signer list";
return temBAD_SIGNER;
}
// Make sure no signers reference this account. Also make sure the
// quorum can be reached.
std::uint64_t allSignersWeight (0);
for (auto const& signer : signers)
{
std::uint32_t const weight = signer.weight;
if (weight <= 0)
{
JLOG(j.trace) << "Every signer must have a positive weight.";
return temBAD_WEIGHT;
}
allSignersWeight += signer.weight;
if (signer.account == account)
{
JLOG(j.trace) << "A signer may not self reference account.";
return temBAD_SIGNER;
}
// Don't verify that the signer accounts exist. Non-existent accounts
// may be phantom accounts (which are permitted).
}
if ((quorum <= 0) || (allSignersWeight < quorum))
{
JLOG(j.trace) << "Quorum is unreachable";
return temBAD_QUORUM;
}
return tesSUCCESS;
}
开发者ID:E-LLP,项目名称:rippled,代码行数:57,代码来源:SetSignerList.cpp
示例13: stop
void stop () override
{
stop_async ();
JLOG(m_journal.debug()) << "Waiting to stop";
std::unique_lock<std::mutex> lk{m_mut};
m_cv.wait(lk, [this]{return m_asyncHandlersCompleted;});
lk.unlock();
JLOG(m_journal.debug()) << "Stopped";
}
开发者ID:mellery451,项目名称:rippled,代码行数:10,代码来源:ResolverAsio.cpp
示例14: STBase
STPathSet::STPathSet (SerialIter& sit, SField const& name)
: STBase(name)
{
std::vector<STPathElement> path;
for(;;)
{
int iType = sit.get8 ();
if (iType == STPathElement::typeNone ||
iType == STPathElement::typeBoundary)
{
if (path.empty ())
{
JLOG (debugLog().error())
<< "Empty path in pathset";
Throw<std::runtime_error> ("empty path");
}
push_back (path);
path.clear ();
if (iType == STPathElement::typeNone)
return;
}
else if (iType & ~STPathElement::typeAll)
{
JLOG (debugLog().error())
<< "Bad path element " << iType << " in pathset";
Throw<std::runtime_error> ("bad path element");
}
else
{
auto hasAccount = iType & STPathElement::typeAccount;
auto hasCurrency = iType & STPathElement::typeCurrency;
auto hasIssuer = iType & STPathElement::typeIssuer;
AccountID account;
Currency currency;
AccountID issuer;
if (hasAccount)
account.copyFrom (sit.get160 ());
if (hasCurrency)
currency.copyFrom (sit.get160 ());
if (hasIssuer)
issuer.copyFrom (sit.get160 ());
path.emplace_back (account, currency, issuer, hasCurrency);
}
}
}
开发者ID:bachase,项目名称:rippled,代码行数:53,代码来源:STPathSet.cpp
示例15: JLOG
bool JMP3::setLoop(bool loop) {
JLOG("Start JMP3::setLoop");
if (!init_done) {
JLOG("JMP3::setLoop called but init_done is false!");
return false;
}
#ifdef MP3_SUPPORT
sceMp3SetLoopNum(m_mp3Handle, (loop == true) ? -1 : 0);
#endif
return (m_loop = loop);
JLOG("End JMP3::setLoop");
}
开发者ID:173210,项目名称:w-menu,代码行数:12,代码来源:JMP3.cpp
示例16: Reprocess
/** Process a single ledger
@param ledgerIndex The index of the ledger to process.
@param ledgerHash The known correct hash of the ledger.
@param doNodes Ensure all ledger nodes are in the node db.
@param doTxns Reprocess (account) transactions to SQL databases.
@return `true` if the ledger was cleaned.
*/
bool doLedger(
LedgerIndex const& ledgerIndex,
LedgerHash const& ledgerHash,
bool doNodes,
bool doTxns)
{
auto nodeLedger = app_.getInboundLedgers().acquire (
ledgerHash, ledgerIndex, InboundLedger::fcGENERIC);
if (!nodeLedger)
{
JLOG (j_.debug()) << "Ledger " << ledgerIndex << " not available";
app_.getLedgerMaster().clearLedger (ledgerIndex);
app_.getInboundLedgers().acquire(
ledgerHash, ledgerIndex, InboundLedger::fcGENERIC);
return false;
}
auto dbLedger = loadByIndex(ledgerIndex, app_);
if (! dbLedger ||
(dbLedger->info().hash != ledgerHash) ||
(dbLedger->info().parentHash != nodeLedger->info().parentHash))
{
// Ideally we'd also check for more than one ledger with that index
JLOG (j_.debug()) <<
"Ledger " << ledgerIndex << " mismatches SQL DB";
doTxns = true;
}
if(! app_.getLedgerMaster().fixIndex(ledgerIndex, ledgerHash))
{
JLOG (j_.debug()) << "ledger " << ledgerIndex
<< " had wrong entry in history";
doTxns = true;
}
if (doNodes && !nodeLedger->walkLedger(app_.journal ("Ledger")))
{
JLOG (j_.debug()) << "Ledger " << ledgerIndex << " is missing nodes";
app_.getLedgerMaster().clearLedger (ledgerIndex);
app_.getInboundLedgers().acquire(
ledgerHash, ledgerIndex, InboundLedger::fcGENERIC);
return false;
}
if (doTxns && !pendSaveValidated(app_, nodeLedger, true, false))
{
JLOG (j_.debug()) << "Failed to save ledger " << ledgerIndex;
return false;
}
return true;
}
开发者ID:blockc,项目名称:rippled,代码行数:59,代码来源:LedgerCleaner.cpp
示例17: JLOG
// - A ripple nodes output issuer must be the node's account or the next node's
// account.
// - Offers can only go directly to another offer if the currency and issuer are
// an exact match.
// - Real issuers must be specified for non-XRP.
TER PathState::pushImpliedNodes (
AccountID const& account, // --> Delivering to this account.
Currency const& currency, // --> Delivering this currency.
AccountID const& issuer) // --> Delivering this issuer.
{
TER resultCode = tesSUCCESS;
JLOG (j_.trace) << "pushImpliedNodes>" <<
" " << account <<
" " << currency <<
" " << issuer;
if (nodes_.back ().issue_.currency != currency)
{
// Currency is different, need to convert via an offer from an order
// book. xrpAccount() does double duty as signaling "this is an order
// book".
// Corresponds to "Implies an offer directory" in the diagram, currently
// at http://goo.gl/Uj3HAB.
auto type = isXRP(currency) ? STPathElement::typeCurrency
: STPathElement::typeCurrency | STPathElement::typeIssuer;
// The offer's output is what is now wanted.
// xrpAccount() is a placeholder for offers.
resultCode = pushNode (type, xrpAccount(), currency, issuer);
}
// For ripple, non-XRP, ensure the issuer is on at least one side of the
// transaction.
if (resultCode == tesSUCCESS
&& !isXRP(currency)
&& nodes_.back ().account_ != issuer
// Previous is not issuing own IOUs.
&& account != issuer)
// Current is not receiving own IOUs.
{
// Need to ripple through issuer's account.
// Case "Implies an another node: (pushImpliedNodes)" in the document.
// Intermediate account is the needed issuer.
resultCode = pushNode (
STPathElement::typeAll, issuer, currency, issuer);
}
JLOG (j_.trace)
<< "pushImpliedNodes< : " << transToken (resultCode);
return resultCode;
}
开发者ID:alexandrev,项目名称:rippled,代码行数:56,代码来源:PathState.cpp
示例18: lock
void CAlarmMachine::SetAdemcoEvent(EventSource resource,
int ademco_event, int zone, int subzone,
const time_t& timestamp, const time_t& recv_time,
const ademco::char_array_ptr& xdata
)
{
AUTO_LOG_FUNCTION;
std::lock_guard<std::mutex> lock(_lock4AdemcoEventList);
ademco::AdemcoEventPtr ademcoEvent = std::make_shared<AdemcoEvent>(resource, ademco_event, zone, subzone, timestamp, recv_time, xdata);
if (EVENT_PRIVATE_EVENT_BASE <= ademco_event && ademco_event <= EVENT_PRIVATE_EVENT_MAX) {
// 内部事件立即处理
} else {
#ifdef _DEBUG
wchar_t wtime[32] = { 0 };
struct tm tmtm;
localtime_s(&tmtm, &recv_time);
wcsftime(wtime, 32, L"%Y-%m-%d %H:%M:%S", &tmtm);
JLOG(L"param: %s\n", wtime);
#endif
time_t now = time(nullptr);
auto iter = _ademcoEventFilter.begin();
while (iter != _ademcoEventFilter.end()) {
const ademco::AdemcoEventPtr& oldEvent = *iter;
#ifdef _DEBUG
localtime_s(&tmtm, &now);
wcsftime(wtime, 32, L"%Y-%m-%d %H:%M:%S", &tmtm);
JLOG(L"now: %s\n", wtime);
localtime_s(&tmtm, &oldEvent->_recv_time);
wcsftime(wtime, 32, L"%Y-%m-%d %H:%M:%S", &tmtm);
JLOG(L"old: %s\n", wtime);
#endif
if (now - oldEvent->_recv_time >= 6) {
_ademcoEventFilter.erase(iter);
iter = _ademcoEventFilter.begin();
continue;
} else if (oldEvent->operator== (*ademcoEvent)) {
JLOG(L"same AdemcoEvent, delete it. ademco_id %06d, event %04d, zone %03d, gg %02d\n",
_ademco_id, ademcoEvent->_event, ademcoEvent->_zone, ademcoEvent->_sub_zone);
_ademcoEventFilter.erase(iter);
_ademcoEventFilter.push_back(ademcoEvent);
return;
}
iter++;
}
_ademcoEventFilter.push_back(ademcoEvent);
}
HandleAdemcoEvent(ademcoEvent);
}
开发者ID:captainwong,项目名称:AlarmCenterTestTools,代码行数:49,代码来源:AlarmMachine.cpp
示例19: JLOG
NotTEC
Transactor::checkSingleSign (PreclaimContext const& ctx)
{
auto const id = ctx.tx.getAccountID(sfAccount);
auto const sle = ctx.view.read(
keylet::account(id));
auto const hasAuthKey = sle->isFieldPresent (sfRegularKey);
// Consistency: Check signature & verify the transaction's signing
// public key is authorized for signing.
auto const spk = ctx.tx.getSigningPubKey();
if (!publicKeyType (makeSlice (spk)))
{
JLOG(ctx.j.trace()) <<
"checkSingleSign: signing public key type is unknown";
return tefBAD_AUTH; // FIXME: should be better error!
}
auto const pkAccount = calcAccountID (
PublicKey (makeSlice (spk)));
if (pkAccount == id)
{
// Authorized to continue.
if (sle->isFlag(lsfDisableMaster))
return tefMASTER_DISABLED;
}
else if (hasAuthKey &&
(pkAccount == sle->getAccountID (sfRegularKey)))
{
// Authorized to continue.
}
else if (hasAuthKey)
{
JLOG(ctx.j.trace()) <<
"checkSingleSign: Not authorized to use account.";
return tefBAD_AUTH;
}
else
{
JLOG(ctx.j.trace()) <<
"checkSingleSign: Not authorized to use account.";
return tefBAD_AUTH_MASTER;
}
return tesSUCCESS;
}
开发者ID:Empresaria,项目名称:rippled,代码行数:48,代码来源:Transactor.cpp
示例20: 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,
std::shared_ptr<ReadView const>& referenceLedger)
{
LedgerHash ledgerHash;
if (!referenceLedger || (referenceLedger->info().seq < ledgerIndex))
{
referenceLedger = app_.getLedgerMaster().getValidatedLedger();
if (!referenceLedger)
{
JLOG (j_.warn()) << "No validated ledger";
return ledgerHash; // Nothing we can do. No validated ledger.
}
}
if (referenceLedger->info().seq >= 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 = getCandidateLedger (ledgerIndex);
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 =
app_.getInboundLedgers().acquire(
refHash, refIndex, InboundLedger::fcGENERIC);
if (referenceLedger)
ledgerHash = getLedgerHash(
referenceLedger, ledgerIndex);
}
}
}
else
JLOG (j_.warn()) << "Validated ledger is prior to target ledger";
return ledgerHash;
}
开发者ID:blockc,项目名称:rippled,代码行数:53,代码来源:LedgerCleaner.cpp
注:本文中的JLOG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论