Files
rippled/include/xrpl/shamap/SHAMapMissingNode.h
Bart 1d42c4f6de refactor: Remove unnecessary copyright notices already covered by LICENSE.md (#5929)
Per XLS-0095, we are taking steps to rename ripple(d) to xrpl(d).

This change specifically removes all copyright notices referencing Ripple, XRPLF, and certain affiliated contributors upon mutual agreement, so the notice in the LICENSE.md file applies throughout. Copyright notices referencing external contributions remain as-is. Duplicate verbiage is also removed.
2025-11-04 08:33:42 +00:00

56 lines
1.3 KiB
C++

#ifndef XRPL_SHAMAP_SHAMAPMISSINGNODE_H_INCLUDED
#define XRPL_SHAMAP_SHAMAPMISSINGNODE_H_INCLUDED
#include <xrpl/basics/base_uint.h>
#include <xrpl/shamap/SHAMapTreeNode.h>
#include <iosfwd>
#include <stdexcept>
#include <string>
#include <type_traits>
namespace ripple {
enum class SHAMapType {
TRANSACTION = 1, // A tree of transactions
STATE = 2, // A tree of state nodes
FREE = 3, // A tree not part of a ledger
};
inline std::string
to_string(SHAMapType t)
{
switch (t)
{
case SHAMapType::TRANSACTION:
return "Transaction Tree";
case SHAMapType::STATE:
return "State Tree";
case SHAMapType::FREE:
return "Free Tree";
default:
return std::to_string(
safe_cast<std::underlying_type_t<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, uint256 const& id)
: std::runtime_error(
"Missing Node: " + to_string(t) + ": id " + to_string(id))
{
}
};
} // namespace ripple
#endif