diff --git a/include/xrpl/protocol/detail/features.macro b/include/xrpl/protocol/detail/features.macro index 92f05f8149..6ac33f3e78 100644 --- a/include/xrpl/protocol/detail/features.macro +++ b/include/xrpl/protocol/detail/features.macro @@ -62,7 +62,6 @@ XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(DisallowIncoming, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes) -XRPL_FIX (TrustLinesToSelf, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(ExpandedSignerList, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(CheckCashMakesTrustLine, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(FlowSortStrands, Supported::yes, VoteBehavior::DefaultYes) @@ -119,6 +118,7 @@ XRPL_RETIRE(fixReducedOffersV1) XRPL_RETIRE(fixRmSmallIncreasedQOffers) XRPL_RETIRE(fixSTAmountCanonicalize) XRPL_RETIRE(fixTakerDryOfferRemoval) +XRPL_RETIRE(fixTrustLinesToSelf) XRPL_RETIRE(CryptoConditions) XRPL_RETIRE(Escrow) XRPL_RETIRE(EnforceInvariants) diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index 0f5cf65f72..1a53f39f60 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -121,7 +121,8 @@ class Feature_test : public beast::unit_test::suite // Test a random sampling of the variables. If any of these get retired // or removed, swap out for any other feature. BEAST_EXPECT( - featureToName(fixTrustLinesToSelf) == "fixTrustLinesToSelf"); + featureToName(fixRemoveNFTokenAutoTrustLine) == + "fixRemoveNFTokenAutoTrustLine"); BEAST_EXPECT(featureToName(featureFlow) == "Flow"); BEAST_EXPECT(featureToName(featureNegativeUNL) == "NegativeUNL"); BEAST_EXPECT( diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/xrpld/app/tx/detail/Change.cpp index 92b0eb2bb2..4832287c2e 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/xrpld/app/tx/detail/Change.cpp @@ -147,88 +147,6 @@ Change::preCompute() account_ == beast::zero, "ripple::Change::preCompute : zero account"); } -void -Change::activateTrustLinesToSelfFix() -{ - JLOG(j_.warn()) << "fixTrustLinesToSelf amendment activation code starting"; - - auto removeTrustLineToSelf = [this](Sandbox& sb, uint256 id) { - auto tl = sb.peek(keylet::child(id)); - - if (tl == nullptr) - { - JLOG(j_.warn()) << id << ": Unable to locate trustline"; - return true; - } - - if (tl->getType() != ltRIPPLE_STATE) - { - JLOG(j_.warn()) << id << ": Unexpected type " - << static_cast(tl->getType()); - return true; - } - - auto const& lo = tl->getFieldAmount(sfLowLimit); - auto const& hi = tl->getFieldAmount(sfHighLimit); - - if (lo != hi) - { - JLOG(j_.warn()) << id << ": Trustline doesn't meet requirements"; - return true; - } - - if (auto const page = tl->getFieldU64(sfLowNode); !sb.dirRemove( - keylet::ownerDir(lo.getIssuer()), page, tl->key(), false)) - { - JLOG(j_.error()) << id << ": failed to remove low entry from " - << toBase58(lo.getIssuer()) << ":" << page - << " owner directory"; - return false; - } - - if (auto const page = tl->getFieldU64(sfHighNode); !sb.dirRemove( - keylet::ownerDir(hi.getIssuer()), page, tl->key(), false)) - { - JLOG(j_.error()) << id << ": failed to remove high entry from " - << toBase58(hi.getIssuer()) << ":" << page - << " owner directory"; - return false; - } - - if (tl->getFlags() & lsfLowReserve) - adjustOwnerCount( - sb, sb.peek(keylet::account(lo.getIssuer())), -1, j_); - - if (tl->getFlags() & lsfHighReserve) - adjustOwnerCount( - sb, sb.peek(keylet::account(hi.getIssuer())), -1, j_); - - sb.erase(tl); - - JLOG(j_.warn()) << "Successfully deleted trustline " << id; - - return true; - }; - - using namespace std::literals; - - Sandbox sb(&view()); - - if (removeTrustLineToSelf( - sb, - uint256{ - "2F8F21EFCAFD7ACFB07D5BB04F0D2E18587820C7611305BB674A64EAB0FA71E1"sv}) && - removeTrustLineToSelf( - sb, - uint256{ - "326035D5C0560A9DA8636545DD5A1B0DFCFF63E68D491B5522B767BB00564B1A"sv})) - { - JLOG(j_.warn()) << "fixTrustLinesToSelf amendment activation code " - "executed successfully"; - sb.apply(ctx_.rawView()); - } -} - TER Change::applyAmendment() { @@ -305,9 +223,6 @@ Change::applyAmendment() amendments.push_back(amendment); amendmentObject->setFieldV256(sfAmendments, amendments); - if (amendment == fixTrustLinesToSelf) - activateTrustLinesToSelfFix(); - ctx_.app.getAmendmentTable().enable(amendment); if (!ctx_.app.getAmendmentTable().isSupported(amendment)) diff --git a/src/xrpld/app/tx/detail/Change.h b/src/xrpld/app/tx/detail/Change.h index d71c5baeb5..9ff37b1515 100644 --- a/src/xrpld/app/tx/detail/Change.h +++ b/src/xrpld/app/tx/detail/Change.h @@ -29,9 +29,6 @@ public: preclaim(PreclaimContext const& ctx); private: - void - activateTrustLinesToSelfFix(); - TER applyAmendment(); diff --git a/src/xrpld/app/tx/detail/SetTrust.cpp b/src/xrpld/app/tx/detail/SetTrust.cpp index 2b10b94374..dcbdbc013f 100644 --- a/src/xrpld/app/tx/detail/SetTrust.cpp +++ b/src/xrpld/app/tx/detail/SetTrust.cpp @@ -195,29 +195,8 @@ SetTrust::preclaim(PreclaimContext const& ctx) auto const currency = saLimitAmount.getCurrency(); auto const uDstAccountID = saLimitAmount.getIssuer(); - if (ctx.view.rules().enabled(fixTrustLinesToSelf)) - { - if (id == uDstAccountID) - return temDST_IS_SRC; - } - else - { - if (id == uDstAccountID) - { - // Prevent trustline to self from being created, - // unless one has somehow already been created - // (in which case doApply will clean it up). - auto const sleDelete = - ctx.view.read(keylet::line(id, uDstAccountID, currency)); - - if (!sleDelete) - { - JLOG(ctx.j.trace()) - << "Malformed transaction: Can not extend credit to self."; - return temDST_IS_SRC; - } - } - } + if (id == uDstAccountID) + return temDST_IS_SRC; // This might be nullptr auto const sleDst = ctx.view.read(keylet::account(uDstAccountID)); @@ -403,21 +382,6 @@ SetTrust::doApply() auto viewJ = ctx_.app.journal("View"); - // Trust lines to self are impossible but because of the old bug there - // are two on 19-02-2022. This code was here to allow those trust lines - // to be deleted. The fixTrustLinesToSelf fix amendment will remove them - // when it enables so this code will no longer be needed. - if (!view().rules().enabled(fixTrustLinesToSelf) && - account_ == uDstAccountID) - { - return trustDelete( - view(), - view().peek(keylet::line(account_, uDstAccountID, currency)), - account_, - uDstAccountID, - viewJ); - } - SLE::pointer sleDst = view().peek(keylet::account(uDstAccountID)); if (!sleDst)