mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-14 02:30:20 +00:00
Include the location from which a SHAMapMissingNode is thrown
This commit is contained in:
@@ -35,13 +35,15 @@ to_string(SHAMapType t)
|
||||
class SHAMapMissingNode : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
SHAMapMissingNode(SHAMapType t, SHAMapHash const& hash)
|
||||
: std::runtime_error("Missing Node: " + to_string(t) + ": hash " + to_string(hash))
|
||||
SHAMapMissingNode(SHAMapType t, SHAMapHash const& hash, std::string const& location)
|
||||
: std::runtime_error(
|
||||
"Missing Node: " + to_string(t) + ": hash " + to_string(hash) + " in: " + location)
|
||||
{
|
||||
}
|
||||
|
||||
SHAMapMissingNode(SHAMapType t, uint256 const& id)
|
||||
: std::runtime_error("Missing Node: " + to_string(t) + ": id " + to_string(id))
|
||||
SHAMapMissingNode(SHAMapType t, uint256 const& id, std::string const& location)
|
||||
: std::runtime_error(
|
||||
"Missing Node: " + to_string(t) + ": id " + to_string(id) + " in: " + location)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -746,7 +746,8 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const
|
||||
if (stateMap_.getHash().isZero() && !header_.accountHash.isZero() &&
|
||||
!stateMap_.fetchRoot(SHAMapHash{header_.accountHash}, nullptr))
|
||||
{
|
||||
missingNodes1.emplace_back(SHAMapType::STATE, SHAMapHash{header_.accountHash});
|
||||
missingNodes1.emplace_back(
|
||||
SHAMapType::STATE, SHAMapHash{header_.accountHash}, "Ledger::walkLedger");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -770,7 +771,8 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const
|
||||
if (txMap_.getHash().isZero() && header_.txHash.isNonZero() &&
|
||||
!txMap_.fetchRoot(SHAMapHash{header_.txHash}, nullptr))
|
||||
{
|
||||
missingNodes2.emplace_back(SHAMapType::TRANSACTION, SHAMapHash{header_.txHash});
|
||||
missingNodes2.emplace_back(
|
||||
SHAMapType::TRANSACTION, SHAMapHash{header_.txHash}, "Ledger::walkLedger");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -272,7 +272,7 @@ SHAMap::fetchNode(SHAMapHash const& hash) const
|
||||
auto node = fetchNodeNT(hash);
|
||||
|
||||
if (!node)
|
||||
Throw<SHAMapMissingNode>(type_, hash);
|
||||
Throw<SHAMapMissingNode>(type_, hash, "fetchNode");
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ SHAMap::descendThrow(SHAMapInnerNode* parent, int branch) const
|
||||
SHAMapTreeNode* ret = descend(parent, branch); // NOLINT(misc-const-correctness)
|
||||
|
||||
if ((ret == nullptr) && !parent->isEmptyBranch(branch))
|
||||
Throw<SHAMapMissingNode>(type_, parent->getChildHash(branch));
|
||||
Throw<SHAMapMissingNode>(type_, parent->getChildHash(branch), "descendThrow");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ SHAMap::descendThrow(SHAMapInnerNode& parent, int branch) const
|
||||
SHAMapTreeNodePtr ret = descend(parent, branch);
|
||||
|
||||
if (!ret && !parent.isEmptyBranch(branch))
|
||||
Throw<SHAMapMissingNode>(type_, parent.getChildHash(branch));
|
||||
Throw<SHAMapMissingNode>(type_, parent.getChildHash(branch), "descendThrow");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -566,7 +566,7 @@ SHAMap::peekNextItem(uint256 const& id, SharedPtrNodeStack& stack) const
|
||||
node = descendThrow(*inner, i);
|
||||
auto leaf = firstBelow(node, stack, i);
|
||||
if (leaf == nullptr)
|
||||
Throw<SHAMapMissingNode>(type_, id);
|
||||
Throw<SHAMapMissingNode>(type_, id, "peekNextItem");
|
||||
XRPL_ASSERT(leaf->isLeaf(), "xrpl::SHAMap::peekNextItem : leaf is valid");
|
||||
return leaf;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ SHAMap::upperBound(uint256 const& id) const
|
||||
node = descendThrow(*inner, branch);
|
||||
auto leaf = firstBelow(node, stack, branch);
|
||||
if (leaf == nullptr)
|
||||
Throw<SHAMapMissingNode>(type_, id);
|
||||
Throw<SHAMapMissingNode>(type_, id, "upperBound");
|
||||
return ConstIterator(this, leaf->peekItem().get(), std::move(stack));
|
||||
}
|
||||
}
|
||||
@@ -657,7 +657,7 @@ SHAMap::lowerBound(uint256 const& id) const
|
||||
node = descendThrow(*inner, branch);
|
||||
auto leaf = lastBelow(node, stack, branch);
|
||||
if (leaf == nullptr)
|
||||
Throw<SHAMapMissingNode>(type_, id);
|
||||
Throw<SHAMapMissingNode>(type_, id, "lowerBound");
|
||||
return ConstIterator(this, leaf->peekItem().get(), std::move(stack));
|
||||
}
|
||||
}
|
||||
@@ -684,7 +684,7 @@ SHAMap::delItem(uint256 const& id)
|
||||
walkTowardsKey(id, &stack);
|
||||
|
||||
if (stack.empty())
|
||||
Throw<SHAMapMissingNode>(type_, id);
|
||||
Throw<SHAMapMissingNode>(type_, id, "delItem");
|
||||
|
||||
auto leaf = intr_ptr::dynamicPointerCast<SHAMapLeafNode>(stack.top().first);
|
||||
stack.pop();
|
||||
@@ -770,7 +770,7 @@ SHAMap::addGiveItem(SHAMapNodeType type, boost::intrusive_ptr<SHAMapItem const>
|
||||
walkTowardsKey(tag, &stack);
|
||||
|
||||
if (stack.empty())
|
||||
Throw<SHAMapMissingNode>(type_, tag);
|
||||
Throw<SHAMapMissingNode>(type_, tag, "addGiveItem");
|
||||
|
||||
auto [node, nodeID] = stack.top();
|
||||
stack.pop();
|
||||
@@ -857,7 +857,7 @@ SHAMap::updateGiveItem(SHAMapNodeType type, boost::intrusive_ptr<SHAMapItem cons
|
||||
walkTowardsKey(tag, &stack);
|
||||
|
||||
if (stack.empty())
|
||||
Throw<SHAMapMissingNode>(type_, tag);
|
||||
Throw<SHAMapMissingNode>(type_, tag, "updateGiveItem");
|
||||
|
||||
auto node = intr_ptr::dynamicPointerCast<SHAMapLeafNode>(stack.top().first);
|
||||
auto nodeID = stack.top().second;
|
||||
|
||||
@@ -153,7 +153,7 @@ SHAMap::compare(SHAMap const& otherMap, Delta& differences, int maxCount) const
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
UNREACHABLE("xrpl::SHAMap::compare : missing a node");
|
||||
Throw<SHAMapMissingNode>(type_, uint256());
|
||||
Throw<SHAMapMissingNode>(type_, uint256(), "compare");
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ SHAMap::walkMap(std::vector<SHAMapMissingNode>& missingNodes, int maxMissing) co
|
||||
}
|
||||
else
|
||||
{
|
||||
missingNodes.emplace_back(type_, node->getChildHash(i));
|
||||
missingNodes.emplace_back(type_, node->getChildHash(i), "walkMap");
|
||||
if (--maxMissing <= 0)
|
||||
return;
|
||||
}
|
||||
@@ -344,7 +344,8 @@ SHAMap::walkMapParallel(std::vector<SHAMapMissingNode>& missingNodes, int maxMis
|
||||
else
|
||||
{
|
||||
std::scoped_lock const l{m};
|
||||
missingNodes.emplace_back(type_, node->getChildHash(i));
|
||||
missingNodes.emplace_back(
|
||||
type_, node->getChildHash(i), "walkMapParallel");
|
||||
if (--maxMissing <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user