From 1516900c4f2547d7283f4cfef76ee88ef6f93d01 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Thu, 26 Oct 2023 16:20:01 +0000 Subject: [PATCH] issuing URITokens is account deletion blocker --- src/ripple/app/tx/impl/DeleteAccount.cpp | 5 +++++ src/ripple/app/tx/impl/URIToken.cpp | 3 +++ src/ripple/protocol/LedgerFormats.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/ripple/app/tx/impl/DeleteAccount.cpp b/src/ripple/app/tx/impl/DeleteAccount.cpp index 9b7b57169..63f87b586 100644 --- a/src/ripple/app/tx/impl/DeleteAccount.cpp +++ b/src/ripple/app/tx/impl/DeleteAccount.cpp @@ -224,6 +224,11 @@ DeleteAccount::preclaim(PreclaimContext const& ctx) return tecHAS_OBLIGATIONS; } + // accounts that have issued URITokens are not allowed to be deleted + // this should be updated in future to be a counter + if (sleAccount->getFlags() & lsfURITokenIssuer) + return tecHAS_OBLIGATIONS; + if (ctx.view.rules().enabled(featureNonFungibleTokensV1)) { // If an issuer has any issued NFTs resident in the ledger then it diff --git a/src/ripple/app/tx/impl/URIToken.cpp b/src/ripple/app/tx/impl/URIToken.cpp index cf61e7b1d..ecdeb64ce 100644 --- a/src/ripple/app/tx/impl/URIToken.cpp +++ b/src/ripple/app/tx/impl/URIToken.cpp @@ -424,6 +424,9 @@ URIToken::doApply() sleU->setFieldU64(sfOwnerNode, *page); view().insert(sleU); + // ensure there is a deletion blocker against the issuer now + sle->setFieldU32(sfFlags, sle->getFlags() | lsfURITokenIssuer); + adjustOwnerCount(view(), sle, 1, j); return tesSUCCESS; } diff --git a/src/ripple/protocol/LedgerFormats.h b/src/ripple/protocol/LedgerFormats.h index 87b6c0f1e..a02bb652f 100644 --- a/src/ripple/protocol/LedgerFormats.h +++ b/src/ripple/protocol/LedgerFormats.h @@ -283,6 +283,8 @@ enum LedgerSpecificFlags { 0x10000000, // True, reject new paychans lsfDisallowIncomingTrustline = 0x20000000, // True, reject new trustlines (only if no issued assets) + lsfURITokenIssuer = + 0x40000000, // True, has minted tokens in the past // ltOFFER lsfPassive = 0x00010000,