This commit is contained in:
Valentin Balaschenko
2025-08-25 14:12:25 +01:00
parent 2107b09445
commit 1226c92aa6

View File

@@ -56,6 +56,10 @@ LedgerHistory::insert(
std::shared_ptr<Ledger const> const& ledger,
bool validated)
{
static unsigned long call_count{0};
JLOG(j_.debug()) << "LedgerHistory lock stats,"
<< ", insert, call_count = " << call_count++;
if (!ledger->isImmutable())
LogicError("mutable Ledger in insert");
@@ -74,6 +78,10 @@ LedgerHistory::insert(
LedgerHash
LedgerHistory::getLedgerHash(LedgerIndex index)
{
static unsigned long call_count{0};
JLOG(j_.debug()) << "LedgerHistory lock stats,"
<< ", getLedgerHash, call_count = " << call_count++;
if (auto it = mLedgersByIndex.find(index); it != mLedgersByIndex.end())
return it->second;
return {};
@@ -82,6 +90,10 @@ LedgerHistory::getLedgerHash(LedgerIndex index)
std::shared_ptr<Ledger const>
LedgerHistory::getLedgerBySeq(LedgerIndex index)
{
static unsigned long call_count{0};
JLOG(j_.debug()) << "LedgerHistory lock stats,"
<< ", getLedgerBySeq, call_count = " << call_count++;
{
auto it = mLedgersByIndex.find(index);
@@ -525,6 +537,10 @@ LedgerHistory::validatedLedger(
bool
LedgerHistory::fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash)
{
static unsigned long call_count{0};
JLOG(j_.debug()) << "LedgerHistory lock stats,"
<< ", fixIndex, call_count = " << call_count++;
auto ledger = m_ledgers_by_hash.fetch(ledgerHash);
auto it = mLedgersByIndex.find(ledgerIndex);
if (ledger && (it != mLedgersByIndex.end()) && (it->second != ledgerHash))