Skip to content

Commit 91b248e

Browse files
fix: remove MPTIssuanceID from tx (#2569)
fixes #2332 : Essentially, remove `mpt_issuance_id` for `MPTokenIssuanceCreate`
1 parent 140ac78 commit 91b248e

File tree

4 files changed

+1
-74
lines changed

4 files changed

+1
-74
lines changed

src/feed/impl/TransactionFeed.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ TransactionFeed::pub(
209209

210210
auto& txnPubobj = pubObj[txKey].as_object();
211211
rpc::insertDeliverMaxAlias(txnPubobj, version);
212-
rpc::insertMPTIssuanceID(txnPubobj, meta);
213212

214213
Json::Value nftJson;
215214
ripple::RPC::insertNFTSyntheticInJson(nftJson, tx, *meta);

src/rpc/RPCHelpers.cpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ toExpandedJson(
260260
auto metaJson = toJson(*meta);
261261
insertDeliveredAmount(metaJson, txn, meta, blobs.date);
262262
insertDeliverMaxAlias(txnJson, apiVersion);
263-
insertMPTIssuanceID(txnJson, meta);
264263

265264
if (nftEnabled == NFTokenjson::ENABLE) {
266265
Json::Value nftJson;
@@ -319,64 +318,6 @@ insertDeliveredAmount(
319318
return false;
320319
}
321320

322-
/**
323-
* @brief Get the delivered amount
324-
*
325-
* @param meta The metadata
326-
* @return The mpt_issuance_id or std::nullopt if not available
327-
*/
328-
static std::optional<ripple::uint192>
329-
getMPTIssuanceID(std::shared_ptr<ripple::TxMeta const> const& meta)
330-
{
331-
ripple::TxMeta const& transactionMeta = *meta;
332-
333-
for (ripple::STObject const& node : transactionMeta.getNodes()) {
334-
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltMPTOKEN_ISSUANCE ||
335-
node.getFName() != ripple::sfCreatedNode)
336-
continue;
337-
338-
auto const& mptNode = node.peekAtField(ripple::sfNewFields).downcast<ripple::STObject>();
339-
return ripple::makeMptID(mptNode[ripple::sfSequence], mptNode[ripple::sfIssuer]);
340-
}
341-
342-
return {};
343-
}
344-
345-
/**
346-
* @brief Check if transaction has a new MPToken created
347-
*
348-
* @param txnJson The transaction Json
349-
* @param meta The metadata
350-
* @return true if the transaction can have a mpt_issuance_id
351-
*/
352-
static bool
353-
canHaveMPTIssuanceID(boost::json::object const& txnJson, std::shared_ptr<ripple::TxMeta const> const& meta)
354-
{
355-
if (txnJson.at(JS(TransactionType)).is_string() and
356-
not boost::iequals(txnJson.at(JS(TransactionType)).as_string(), JS(MPTokenIssuanceCreate)))
357-
return false;
358-
359-
if (meta->getResultTER() != ripple::tesSUCCESS)
360-
return false;
361-
362-
return true;
363-
}
364-
365-
bool
366-
insertMPTIssuanceID(boost::json::object& txnJson, std::shared_ptr<ripple::TxMeta const> const& meta)
367-
{
368-
if (!canHaveMPTIssuanceID(txnJson, meta))
369-
return false;
370-
371-
if (auto const id = getMPTIssuanceID(meta)) {
372-
txnJson[JS(mpt_issuance_id)] = ripple::to_string(*id);
373-
return true;
374-
}
375-
376-
assert(false);
377-
return false;
378-
}
379-
380321
void
381322
insertDeliverMaxAlias(boost::json::object& txJson, std::uint32_t const apiVersion)
382323
{

src/rpc/RPCHelpers.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,6 @@ insertDeliveredAmount(
199199
uint32_t date
200200
);
201201

202-
/**
203-
* @brief Add "mpt_issuance_id" into MPTokenIssuanceCreate transaction json.
204-
*
205-
* @param txnJson The transaction Json object
206-
* @param meta The metadata object
207-
* @return true if the "mpt_issuance_id" is added to the metadata json object
208-
*/
209-
bool
210-
insertMPTIssuanceID(boost::json::object& txnJson, std::shared_ptr<ripple::TxMeta const> const& meta);
211-
212202
/**
213203
* @brief Convert STBase object to JSON
214204
*

tests/unit/rpc/handlers/AccountTxTests.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ constexpr auto kNFT_ID = "05FB0EB4B899F056FA095537C5817163801F544BAFCEA39C995D76
5656
constexpr auto kNFT_ID2 = "05FB0EB4B899F056FA095537C5817163801F544BAFCEA39C995D76DB4D16F9DA";
5757
constexpr auto kNFT_ID3 = "15FB0EB4B899F056FA095537C5817163801F544BAFCEA39C995D76DB4D16F9DF";
5858
constexpr auto kINDEX = "E6DBAFC99223B42257915A63DFC6B0C032D4070F9A574B255AD97466726FC322";
59-
constexpr auto kMPT_ISSUANCE_ID = "000000014B4E9C06F24296074F7BC48F92A97916C6DC5EA9";
6059

6160
} // namespace
6261

@@ -1638,7 +1637,6 @@ TEST_F(RPCAccountTxHandlerTest, MPTTxs_API_v2)
16381637
"Sequence": 1,
16391638
"SigningPubKey": "74657374",
16401639
"TransactionType": "MPTokenIssuanceCreate",
1641-
"mpt_issuance_id": "{}",
16421640
"ledger_index": 11,
16431641
"ctid": "C000000B00000000",
16441642
"date": 1
@@ -1651,8 +1649,7 @@ TEST_F(RPCAccountTxHandlerTest, MPTTxs_API_v2)
16511649
kACCOUNT,
16521650
kACCOUNT,
16531651
kLEDGER_HASH,
1654-
kACCOUNT,
1655-
kMPT_ISSUANCE_ID
1652+
kACCOUNT
16561653
);
16571654

16581655
auto mptTx = createMPTIssuanceCreateTxWithMetadata(kACCOUNT, 50, 1);

0 commit comments

Comments
 (0)