mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-24 07:30:30 +00:00
added XRPL_ASSERTs to enable fuzzing/chaos testing
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <xrpl/basics/IntrusivePointer.ipp>
|
||||
#include <xrpl/basics/Log.h> // IWYU pragma: keep
|
||||
#include <xrpl/basics/TaggedCache.h>
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -673,6 +674,10 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
auto entry = std::make_shared<T>();
|
||||
canonicalize(key, entry, [](SharedPointerType const&) { return false; });
|
||||
|
||||
XRPL_ASSERT(
|
||||
entry != nullptr,
|
||||
"xrpl::TaggedCache::fetchAndModify : entry present after canonicalize");
|
||||
|
||||
callback(*entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -504,6 +504,9 @@ LedgerHistory::validatedLedger(
|
||||
consensusValidated_.fetchAndModify(index, [&](CvEntry& entry) {
|
||||
if (entry.built && !entry.validated)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
entry.consensus.has_value(),
|
||||
"xrpl::LedgerHistory::validatedLedger : consensus set when built set");
|
||||
if (entry.built.value() != hash)
|
||||
{
|
||||
JLOG(j_.error()) << "MISMATCH: seq=" << index << " built:" << entry.built.value()
|
||||
@@ -597,6 +600,10 @@ LedgerHistory::clearLedgerCachePrior(LedgerIndex seq)
|
||||
}
|
||||
}
|
||||
indexSize = lock->byIndex.size();
|
||||
|
||||
XRPL_ASSERT(
|
||||
lock->byIndex.empty() || lock->byIndex.begin()->first >= seq,
|
||||
"xrpl::LedgerHistory::clearLedgerCachePrior : byIndex pruned to seq");
|
||||
}
|
||||
|
||||
JLOG(j_.debug()) << "LedgersByHash: cleared " << hashesCleared << " entries before seq " << seq
|
||||
|
||||
Reference in New Issue
Block a user