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>
49 return std::make_shared<SHAMapTxLeafNode>(std::move(item), 0, hash);
51 return std::make_shared<SHAMapTxLeafNode>(std::move(item), 0);
65 Throw<std::runtime_error>(
"Short TXN+MD node");
69 Throw<std::out_of_range>(
77 return std::make_shared<SHAMapTxPlusMetaLeafNode>(
78 std::move(item), 0, hash);
80 return std::make_shared<SHAMapTxPlusMetaLeafNode>(std::move(item), 0);
94 Throw<std::runtime_error>(
"short AS node");
98 Throw<std::out_of_range>(
104 Throw<std::runtime_error>(
"Invalid AS node");
109 return std::make_shared<SHAMapAccountStateLeafNode>(
110 std::move(item), 0, hash);
112 return std::make_shared<SHAMapAccountStateLeafNode>(std::move(item), 0);
121 auto const type = rawNode[rawNode.
size() - 1];
125 bool const hashValid =
false;
143 Throw<std::runtime_error>(
150 if (rawNode.
size() < 4)
151 Throw<std::runtime_error>(
"prefix: short node");
155 auto const type = safe_cast<HashPrefix>(
156 (safe_cast<std::uint32_t>(rawNode[0]) << 24) +
157 (safe_cast<std::uint32_t>(rawNode[1]) << 16) +
158 (safe_cast<std::uint32_t>(rawNode[2]) << 8) +
159 (safe_cast<std::uint32_t>(rawNode[3])));
163 bool const hashValid =
true;
177 Throw<std::runtime_error>(
178 "prefix: unknown type (" +