mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
Address reviewer's feedback.
This commit is contained in:
@@ -59,19 +59,11 @@ STIssue::STIssue(SerialIter& sit, SField const& name) : STBase{name}
|
||||
auto const seqSize = sizeof(std::uint32_t);
|
||||
if (account == noAccount())
|
||||
{
|
||||
// get32() swaps BE wire bytes to host order; memcpy then stores
|
||||
// host-order bytes into the MPTID. On LE this produces a
|
||||
// byte-swapped MPTID relative to the canonical value from
|
||||
// makeMptID(), but add() has the same inversion so the
|
||||
// round-trip is consistent within a single-arch deployment.
|
||||
std::uint32_t sequence = sit.get32();
|
||||
memcpy(mptID.data(), &sequence, sizeof(sequence));
|
||||
}
|
||||
else
|
||||
{
|
||||
// V2: read raw wire bytes directly into the MPTID. No byte
|
||||
// swapping; the canonical BE layout from makeMptID() is
|
||||
// preserved end-to-end.
|
||||
auto const rawBytes = sit.getRaw(seqSize);
|
||||
memcpy(mptID.data(), rawBytes.data(), rawBytes.size());
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <xrpl/protocol/UintTypes.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <bit>
|
||||
#include <cstdint>
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -165,6 +166,7 @@ public:
|
||||
testcase("MPT serialization - serialized sequence bytes are canonical big-endian");
|
||||
using namespace jtx;
|
||||
Account const alice{"alice"};
|
||||
BEAST_EXPECT(std::endian::native == std::endian::little);
|
||||
|
||||
// Sequence 240 = 0x000000F0.
|
||||
// Canonical BE bytes a client would expect: {0x00, 0x00, 0x00, 0xF0}.
|
||||
|
||||
Reference in New Issue
Block a user