From c19aeade77fb51ab5ee31effd14156c9e7e6eed7 Mon Sep 17 00:00:00 2001 From: Bart <11445373+bthomee@users.noreply.github.com> Date: Wed, 4 Feb 2026 13:59:17 -0500 Subject: [PATCH] Add assert --- src/libxrpl/nodestore/DatabaseNodeImp.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libxrpl/nodestore/DatabaseNodeImp.cpp b/src/libxrpl/nodestore/DatabaseNodeImp.cpp index a915df57f6..11152a2027 100644 --- a/src/libxrpl/nodestore/DatabaseNodeImp.cpp +++ b/src/libxrpl/nodestore/DatabaseNodeImp.cpp @@ -71,9 +71,12 @@ DatabaseNodeImp::fetchBatch(std::vector const& hashes) } // Get the node objects that match the hashes from the backend. To protect - // against the backends returning more results than expected, the container - // is resized to the number of hashes. + // against the backends returning fewer or more results than expected, the + // container is resized to the number of hashes. auto results = backend_->fetchBatch(batch).first; + XRPL_ASSERT( + results.size() == hashes.size() || results.empty(), + "number of output objects either matches number of input hashes or is empty"); results.resize(hashes.size()); for (size_t i = 0; i < results.size(); ++i) {