diff --git a/src/ripple/nodestore/impl/DecodedBlob.cpp b/src/ripple/nodestore/impl/DecodedBlob.cpp index 0c5a5de20..9321ae0b2 100644 --- a/src/ripple/nodestore/impl/DecodedBlob.cpp +++ b/src/ripple/nodestore/impl/DecodedBlob.cpp @@ -30,10 +30,8 @@ DecodedBlob::DecodedBlob(void const* key, void const* value, int valueBytes) /* Data format: Bytes - - 0...7 Unused - 8 char One of NodeObjectType - 9...end The body of the object data + 0 uint8 One of NodeObjectType + 1...end The body of the object data */ m_success = false; @@ -41,19 +39,17 @@ DecodedBlob::DecodedBlob(void const* key, void const* value, int valueBytes) // VFALCO NOTE Ledger indexes should have started at 1 m_objectType = hotUNKNOWN; m_objectData = nullptr; - m_dataBytes = std::max(0, valueBytes - 9); + m_dataBytes = std::max(0, valueBytes - 1); - // VFALCO NOTE What about bytes 4 through 7 inclusive? - - if (valueBytes > 8) + if (valueBytes != 0) { unsigned char const* byte = static_cast(value); - m_objectType = safe_cast(byte[8]); + m_objectType = safe_cast(byte[0]); } - if (valueBytes > 9) + if (valueBytes > 1) { - m_objectData = static_cast(value) + 9; + m_objectData = static_cast(value) + 1; switch (m_objectType) { diff --git a/src/ripple/nodestore/impl/EncodedBlob.cpp b/src/ripple/nodestore/impl/EncodedBlob.cpp index 4ec15b102..3b33c8be4 100644 --- a/src/ripple/nodestore/impl/EncodedBlob.cpp +++ b/src/ripple/nodestore/impl/EncodedBlob.cpp @@ -28,14 +28,11 @@ EncodedBlob::prepare(std::shared_ptr const& object) { m_key = object->getHash().begin(); - auto ret = m_data.alloc(object->getData().size() + 9); + auto ret = m_data.alloc(object->getData().size() + 1); - // the first 8 bytes are unused - std::memset(ret, 0, 8); + ret[0] = static_cast(object->getType()); - ret[8] = static_cast(object->getType()); - - std::memcpy(ret + 9, object->getData().data(), object->getData().size()); + std::memcpy(ret + 1, object->getData().data(), object->getData().size()); } } // namespace NodeStore