diff --git a/src/libxrpl/protocol/STIssue.cpp b/src/libxrpl/protocol/STIssue.cpp index 7fc5074caa7..1d7d71b0152 100644 --- a/src/libxrpl/protocol/STIssue.cpp +++ b/src/libxrpl/protocol/STIssue.cpp @@ -58,7 +58,10 @@ STIssue::STIssue(SerialIter& sit, SField const& name) : STBase{name} if (noAccount() == account) { uint192 mptID; + MPTID mptID; std::uint32_t sequence = sit.get32(); + static_assert( + MPTID::size() == sizeof(sequence) + sizeof(currencyOrAccount)); memcpy(mptID.data(), &sequence, sizeof(sequence)); memcpy( mptID.data() + sizeof(sequence), @@ -108,17 +111,18 @@ STIssue::add(Serializer& s) const s.addBitString(asset_.get().currency); if (!isXRP(asset_.get().currency)) s.addBitString(asset_.get().account); + auto const& issue = asset_.get(); + s.addBitString(issue.currency); + if (!isXRP(issue.currency)) + s.addBitString(issue.account); } else { - s.addBitString(asset_.get().getIssuer()); + auto const& issue = asset_.get(); + s.addBitString(issue.getIssuer()); s.addBitString(noAccount()); std::uint32_t sequence; - memcpy( - &sequence, - asset_.get().getMptID().data(), - sizeof(sequence)); - s.add32(sequence); + memcpy(&sequence, issue.getMptID().data(), sizeof(sequence)); } }