diff --git a/src/ripple/app/tx/impl/Payment.cpp b/src/ripple/app/tx/impl/Payment.cpp index b17dcf9c89b..393a061a1f2 100644 --- a/src/ripple/app/tx/impl/Payment.cpp +++ b/src/ripple/app/tx/impl/Payment.cpp @@ -459,7 +459,7 @@ Payment::doApply() return ter; auto const& mpt = saDstAmount.mptIssue(); - auto const& issuer = mpt.account(); + auto const& issuer = mpt.getIssuer(); // If globally/individually locked then // can't send between holders // holder can send back to issuer diff --git a/src/ripple/ledger/impl/View.cpp b/src/ripple/ledger/impl/View.cpp index 3d733566ad9..0c2ecd1eccd 100644 --- a/src/ripple/ledger/impl/View.cpp +++ b/src/ripple/ledger/impl/View.cpp @@ -1348,7 +1348,7 @@ rippleSendMPT( assert(uSenderID != uReceiverID); // Safe to get MPT since rippleSendMPT is only called by accountSendMPT - auto const issuer = saAmount.mptIssue().account(); + auto const issuer = saAmount.mptIssue().getIssuer(); if (uSenderID == issuer || uReceiverID == issuer || issuer == noAccount()) { @@ -1859,7 +1859,7 @@ rippleMPTCredit( beast::Journal j) { auto const mptID = keylet::mptIssuance(saAmount.mptIssue().mpt()); - auto const issuer = saAmount.mptIssue().account(); + auto const issuer = saAmount.mptIssue().getIssuer(); if (uSenderID == issuer) { if (auto sle = view.peek(mptID)) diff --git a/src/ripple/protocol/Asset.h b/src/ripple/protocol/Asset.h index 8d9628b6e34..515495d431a 100644 --- a/src/ripple/protocol/Asset.h +++ b/src/ripple/protocol/Asset.h @@ -99,6 +99,9 @@ class Asset std::string getText() const; + AccountID const& + getIssuer() const; + friend constexpr bool operator==(Asset const& lhs, Asset const& rhs) { diff --git a/src/ripple/protocol/BaseAmount.h b/src/ripple/protocol/BaseAmount.h index 32ac8ad0875..96b80842692 100644 --- a/src/ripple/protocol/BaseAmount.h +++ b/src/ripple/protocol/BaseAmount.h @@ -191,7 +191,7 @@ class BaseAmount mantissa() const noexcept; T const& - issue() const; + asset() const; AccountID const& getIssuer() const; @@ -294,7 +294,7 @@ template std::int64_t getSNValue(BaseAmount const& amount) { - if (!isNative(amount.issue())) + if (!isNative(amount.asset())) Throw("amount is not native!"); auto ret = static_cast(amount.mantissa()); @@ -311,7 +311,7 @@ template std::int64_t getMPTValue(BaseAmount const& amount) { - if (!isMPT(amount.issue())) + if (!isMPT(amount.asset())) Throw("amount is not MPT!"); auto ret = static_cast(amount.mantissa()); @@ -507,9 +507,9 @@ BaseAmount::mantissa() const noexcept template T const& -BaseAmount::issue() const +BaseAmount::asset() const { - return mAsset.issue(); + return mAsset; } template diff --git a/src/ripple/protocol/Issue.h b/src/ripple/protocol/Issue.h index 2638cc7366e..7e81b9cc2c0 100644 --- a/src/ripple/protocol/Issue.h +++ b/src/ripple/protocol/Issue.h @@ -48,6 +48,9 @@ class Issue std::string getText() const; + + AccountID const& + getIssuer() const; }; bool diff --git a/src/ripple/protocol/MPTIssue.h b/src/ripple/protocol/MPTIssue.h index 28e5d492e44..f5535e2fbb3 100644 --- a/src/ripple/protocol/MPTIssue.h +++ b/src/ripple/protocol/MPTIssue.h @@ -36,7 +36,7 @@ class MPTIssue } AccountID const& - account() const + getIssuer() const { return mpt_.second; } diff --git a/src/ripple/protocol/impl/Asset.cpp b/src/ripple/protocol/impl/Asset.cpp index 3ef64dbde94..97d9b920e2b 100644 --- a/src/ripple/protocol/impl/Asset.cpp +++ b/src/ripple/protocol/impl/Asset.cpp @@ -41,6 +41,14 @@ Asset::getText() const return to_string(mptIssue().getMptID()); } +AccountID const& +Asset::getIssuer() const +{ + if (isIssue()) + return issue().getIssuer(); + return mptIssue().getIssuer(); +} + std::string to_string(Asset const& asset) { diff --git a/src/ripple/protocol/impl/Issue.cpp b/src/ripple/protocol/impl/Issue.cpp index 623ce24bb15..00c2ef13e42 100644 --- a/src/ripple/protocol/impl/Issue.cpp +++ b/src/ripple/protocol/impl/Issue.cpp @@ -49,6 +49,12 @@ Issue::getText() const return ret; } +AccountID const& +Issue::getIssuer() const +{ + return account; +} + bool isConsistent(Issue const& ac) { diff --git a/src/ripple/protocol/impl/MPTIssue.cpp b/src/ripple/protocol/impl/MPTIssue.cpp index ff19537e4ed..24305d23a34 100644 --- a/src/ripple/protocol/impl/MPTIssue.cpp +++ b/src/ripple/protocol/impl/MPTIssue.cpp @@ -25,7 +25,7 @@ namespace ripple { uint192 MPTIssue::getMptID() const { - return ripple::getMptID(account(), sequence()); + return ripple::getMptID(getIssuer(), sequence()); } } // namespace ripple diff --git a/src/ripple/protocol/impl/STAmount.cpp b/src/ripple/protocol/impl/STAmount.cpp index d4d0849a529..f596bca4502 100644 --- a/src/ripple/protocol/impl/STAmount.cpp +++ b/src/ripple/protocol/impl/STAmount.cpp @@ -763,7 +763,7 @@ STAmount::add(Serializer& s) const // s.add32(mAsset.mptIssue().sequence()); // s.addBitString(mAsset.mptIssue().account()); auto const& mptIssue = mAsset.mptIssue(); - s.addBitString(getMptID(mptIssue.account(), mptIssue.sequence())); + s.addBitString(getMptID(mptIssue.getIssuer(), mptIssue.sequence())); } else { diff --git a/src/ripple/protocol/impl/STTx.cpp b/src/ripple/protocol/impl/STTx.cpp index 9995acd1a76..5f5f6f643ec 100644 --- a/src/ripple/protocol/impl/STTx.cpp +++ b/src/ripple/protocol/impl/STTx.cpp @@ -150,7 +150,7 @@ STTx::getMentionedAccounts() const list.insert(issuer); } else - list.insert(samt->mptIssue().account()); + list.insert(samt->mptIssue().getIssuer()); } }