@@ -40,7 +40,10 @@ findPreviousPage(ApplyView& view, Keylet const& directory, SLE::ref start)
4040 {
4141 node = view.peek (keylet::page (directory, page));
4242 if (!node)
43+ { // LCOV_EXCL_START
4344 LogicError (" Directory chain: root back-pointer broken." );
45+ // LCOV_EXCL_STOP
46+ }
4447 }
4548
4649 auto indexes = node->getFieldV256 (sfIndexes);
@@ -59,7 +62,7 @@ insertKey(
5962 if (preserveOrder)
6063 {
6164 if (std::find (indexes.begin (), indexes.end (), key) != indexes.end ())
62- LogicError (" dirInsert: double insertion" );
65+ LogicError (" dirInsert: double insertion" ); // LCOV_EXCL_LINE
6366
6467 indexes.push_back (key);
6568 }
@@ -73,7 +76,7 @@ insertKey(
7376 auto pos = std::lower_bound (indexes.begin (), indexes.end (), key);
7477
7578 if (pos != indexes.end () && key == *pos)
76- LogicError (" dirInsert: double insertion" );
79+ LogicError (" dirInsert: double insertion" ); // LCOV_EXCL_LINE
7780
7881 indexes.insert (pos, key);
7982 }
@@ -131,8 +134,15 @@ insertPage(
131134 // it's the default.
132135 if (page != 1 )
133136 node->setFieldU64 (sfIndexPrevious, page - 1 );
137+ XRPL_ASSERT_PARTS (
138+ !nextPage,
139+ " ripple::directory::insertPage" ,
140+ " nextPage has default value" );
141+ /* Reserved for future use when directory pages may be inserted in
142+ * between two other pages instead of only at the end of the chain.
134143 if (nextPage)
135144 node->setFieldU64(sfIndexNext, nextPage);
145+ */
136146 describe (node);
137147 view.insert (node);
138148
@@ -197,10 +207,10 @@ ApplyView::emptyDirDelete(Keylet const& directory)
197207 auto nextPage = node->getFieldU64 (sfIndexNext);
198208
199209 if (nextPage == rootPage && prevPage != rootPage)
200- LogicError (" Directory chain: fwd link broken" );
210+ LogicError (" Directory chain: fwd link broken" ); // LCOV_EXCL_LINE
201211
202212 if (prevPage == rootPage && nextPage != rootPage)
203- LogicError (" Directory chain: rev link broken" );
213+ LogicError (" Directory chain: rev link broken" ); // LCOV_EXCL_LINE
204214
205215 // Older versions of the code would, in some cases, allow the last
206216 // page to be empty. Remove such pages:
@@ -209,7 +219,10 @@ ApplyView::emptyDirDelete(Keylet const& directory)
209219 auto last = peek (keylet::page (directory, nextPage));
210220
211221 if (!last)
222+ { // LCOV_EXCL_START
212223 LogicError (" Directory chain: fwd link broken." );
224+ // LCOV_EXCL_STOP
225+ }
213226
214227 if (!last->getFieldV256 (sfIndexes).empty ())
215228 return false ;
@@ -281,10 +294,16 @@ ApplyView::dirRemove(
281294 if (page == rootPage)
282295 {
283296 if (nextPage == page && prevPage != page)
297+ { // LCOV_EXCL_START
284298 LogicError (" Directory chain: fwd link broken" );
299+ // LCOV_EXCL_STOP
300+ }
285301
286302 if (prevPage == page && nextPage != page)
303+ { // LCOV_EXCL_START
287304 LogicError (" Directory chain: rev link broken" );
305+ // LCOV_EXCL_STOP
306+ }
288307
289308 // Older versions of the code would, in some cases,
290309 // allow the last page to be empty. Remove such
@@ -293,7 +312,10 @@ ApplyView::dirRemove(
293312 {
294313 auto last = peek (keylet::page (directory, nextPage));
295314 if (!last)
315+ { // LCOV_EXCL_START
296316 LogicError (" Directory chain: fwd link broken." );
317+ // LCOV_EXCL_STOP
318+ }
297319
298320 if (last->getFieldV256 (sfIndexes).empty ())
299321 {
@@ -325,25 +347,25 @@ ApplyView::dirRemove(
325347
326348 // This can never happen for nodes other than the root:
327349 if (nextPage == page)
328- LogicError (" Directory chain: fwd link broken" );
350+ LogicError (" Directory chain: fwd link broken" ); // LCOV_EXCL_LINE
329351
330352 if (prevPage == page)
331- LogicError (" Directory chain: rev link broken" );
353+ LogicError (" Directory chain: rev link broken" ); // LCOV_EXCL_LINE
332354
333355 // This node isn't the root, so it can either be in the
334356 // middle of the list, or at the end. Unlink it first
335357 // and then check if that leaves the list with only a
336358 // root:
337359 auto prev = peek (keylet::page (directory, prevPage));
338360 if (!prev)
339- LogicError (" Directory chain: fwd link broken." );
361+ LogicError (" Directory chain: fwd link broken." ); // LCOV_EXCL_LINE
340362 // Fix previous to point to its new next.
341363 prev->setFieldU64 (sfIndexNext, nextPage);
342364 update (prev);
343365
344366 auto next = peek (keylet::page (directory, nextPage));
345367 if (!next)
346- LogicError (" Directory chain: rev link broken." );
368+ LogicError (" Directory chain: rev link broken." ); // LCOV_EXCL_LINE
347369 // Fix next to point to its new previous.
348370 next->setFieldU64 (sfIndexPrevious, prevPage);
349371 update (next);
@@ -367,7 +389,10 @@ ApplyView::dirRemove(
367389 // And the root points to the last page:
368390 auto root = peek (keylet::page (directory, rootPage));
369391 if (!root)
392+ { // LCOV_EXCL_START
370393 LogicError (" Directory chain: root link broken." );
394+ // LCOV_EXCL_STOP
395+ }
371396 root->setFieldU64 (sfIndexPrevious, prevPage);
372397 update (root);
373398
0 commit comments