20 #include <ripple/basics/Log.h>
21 #include <ripple/basics/Slice.h>
22 #include <ripple/basics/contract.h>
23 #include <ripple/basics/safe_cast.h>
24 #include <ripple/beast/core/LexicalCast.h>
25 #include <ripple/protocol/HashPrefix.h>
26 #include <ripple/protocol/digest.h>
27 #include <ripple/shamap/SHAMapAccountStateLeafNode.h>
28 #include <ripple/shamap/SHAMapInnerNode.h>
29 #include <ripple/shamap/SHAMapLeafNode.h>
30 #include <ripple/shamap/SHAMapTreeNode.h>
31 #include <ripple/shamap/SHAMapTxLeafNode.h>
32 #include <ripple/shamap/SHAMapTxPlusMetaLeafNode.h>
35 #include <openssl/sha.h>
48 auto item = std::make_shared<SHAMapItem const>(
52 return std::make_shared<SHAMapTxLeafNode>(std::move(item), 0, hash);
54 return std::make_shared<SHAMapTxLeafNode>(std::move(item), 0);
68 Throw<std::runtime_error>(
"Short TXN+MD node");
72 Throw<std::out_of_range>(
77 auto item = std::make_shared<SHAMapItem const>(tag, s.
peekData());
80 return std::make_shared<SHAMapTxPlusMetaLeafNode>(
81 std::move(item), 0, hash);
83 return std::make_shared<SHAMapTxPlusMetaLeafNode>(std::move(item), 0);
97 Throw<std::runtime_error>(
"short AS node");
101 Throw<std::out_of_range>(
107 Throw<std::runtime_error>(
"Invalid AS node");
109 auto item = std::make_shared<SHAMapItem const>(tag, s.
peekData());
112 return std::make_shared<SHAMapAccountStateLeafNode>(
113 std::move(item), 0, hash);
115 return std::make_shared<SHAMapAccountStateLeafNode>(std::move(item), 0);
124 auto const type = rawNode[rawNode.
size() - 1];
128 bool const hashValid =
false;
146 Throw<std::runtime_error>(
153 if (rawNode.
size() < 4)
154 Throw<std::runtime_error>(
"prefix: short node");
158 auto const type = safe_cast<HashPrefix>(
159 (safe_cast<std::uint32_t>(rawNode[0]) << 24) +
160 (safe_cast<std::uint32_t>(rawNode[1]) << 16) +
161 (safe_cast<std::uint32_t>(rawNode[2]) << 8) +
162 (safe_cast<std::uint32_t>(rawNode[3])));
166 bool const hashValid =
true;
180 Throw<std::runtime_error>(
181 "prefix: unknown type (" +