Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bronek Kozicki <[email protected]>
  • Loading branch information
gregtatcam and Bronek authored Dec 11, 2024
1 parent 10ffdf1 commit cca7133
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/libxrpl/protocol/STIssue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -108,17 +111,18 @@ STIssue::add(Serializer& s) const
s.addBitString(asset_.get<Issue>().currency);
if (!isXRP(asset_.get<Issue>().currency))
s.addBitString(asset_.get<Issue>().account);
auto const& issue = asset_.get<Issue>();
s.addBitString(issue.currency);
if (!isXRP(issue.currency))
s.addBitString(issue.account);
}
else
{
s.addBitString(asset_.get<MPTIssue>().getIssuer());
auto const& issue = asset_.get<MPTIssue>();
s.addBitString(issue.getIssuer());
s.addBitString(noAccount());
std::uint32_t sequence;
memcpy(
&sequence,
asset_.get<MPTIssue>().getMptID().data(),
sizeof(sequence));
s.add32(sequence);
memcpy(&sequence, issue.getMptID().data(), sizeof(sequence));
}
}

Expand Down

0 comments on commit cca7133

Please sign in to comment.