mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Support STN_ARF_UNKNOWN for contexts where the format of a node is not known. Format
is auto-detected.
This commit is contained in:
@@ -157,11 +157,12 @@ public:
|
||||
SHAMapTreeNode(const SHAMapTreeNode& node, uint32 seq); // copy node from older tree
|
||||
SHAMapTreeNode(const SHAMapNode& nodeID, SHAMapItem::pointer item, TNType type, uint32 seq);
|
||||
|
||||
// raw node functions
|
||||
SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned char>& contents, uint32 seq, int format);
|
||||
|
||||
#define STN_ARF_UNKNOWN 0
|
||||
#define STN_ARF_PREFIXED 1
|
||||
#define STN_ARF_WIRE 2
|
||||
|
||||
// raw node functions
|
||||
SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned char>& contents, uint32 seq, int format);
|
||||
void addRaw(Serializer &, int format);
|
||||
|
||||
virtual bool isPopulated() const { return true; }
|
||||
|
||||
@@ -192,6 +192,14 @@ SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& node, SHAMapItem::pointer item,
|
||||
SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned char>& rawNode, uint32 seq, int format)
|
||||
: SHAMapNode(id), mSeq(seq), mType(tnERROR), mFullBelow(false)
|
||||
{
|
||||
if (format == STN_ARF_UNKNOWN)
|
||||
{
|
||||
if ((rawNode.size() < 4) || (rawNode[0] < 10))
|
||||
format = STN_ARF_WIRE;
|
||||
else
|
||||
format = STN_ARF_PREFIXED;
|
||||
}
|
||||
|
||||
if (format == STN_ARF_WIRE)
|
||||
{
|
||||
Serializer s(rawNode);
|
||||
|
||||
Reference in New Issue
Block a user