refactor: Unify upperBound and lowerBound into boundHelper (#7943)

Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
Co-authored-by: vlntb <13349202+vlntb@users.noreply.github.com>
This commit is contained in:
Bart
2026-09-24 12:48:25 +00:00
committed by GitHub
parent 30640a626f
commit 1d7669f528
3 changed files with 88 additions and 44 deletions

View File

@@ -592,6 +592,20 @@ private:
SHAMapLeafNode*
belowHelper(NodePathStack& stack, BelowDirection direction) const;
/**
* Returns the nearest item strictly past `id`, in the given direction.
*
* Walks back up the path to `id`. At each inner node the branches beyond the one `id` takes
* hold the candidates, so the first non-empty one is the closest and the extreme leaf below
* it is the answer.
*
* @param id The key to search from, which need not be in the map.
* @param direction First to search upwards from `id`, Last to search downwards.
* @return An iterator to the item found, or end() if no item lies on that side of `id`.
*/
ConstIterator
boundHelper(uint256 const& id, BelowDirection direction) const;
// Simple descent
// Get a child of the specified node
SHAMapTreeNode*