mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Retire the feature
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
This commit is contained in:
@@ -90,7 +90,6 @@ XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYe
|
||||
XRPL_FIX (TrustLinesToSelf, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(NonFungibleTokensV1_1, 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)
|
||||
XRPL_FEATURE(TicketBatch, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(NegativeUNL, Supported::yes, VoteBehavior::DefaultYes)
|
||||
@@ -154,3 +153,4 @@ XRPL_RETIRE(PayChan)
|
||||
XRPL_RETIRE(SortedDirectories)
|
||||
XRPL_RETIRE(TickSize)
|
||||
XRPL_RETIRE(TrustSetAuth)
|
||||
XRPL_RETIRE(CheckCashMakesTrustLine)
|
||||
|
||||
@@ -698,9 +698,6 @@ class Check_test : public beast::unit_test::suite
|
||||
|
||||
using namespace test::jtx;
|
||||
|
||||
bool const cashCheckMakesTrustLine =
|
||||
features[featureCheckCashMakesTrustLine];
|
||||
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
Account const bob{"bob"};
|
||||
@@ -733,26 +730,10 @@ class Check_test : public beast::unit_test::suite
|
||||
// and fails because he hasn't got a trust line for USD.
|
||||
env(pay(gw, alice, USD(0.5)));
|
||||
env.close();
|
||||
if (!cashCheckMakesTrustLine)
|
||||
{
|
||||
// If cashing a check automatically creates a trustline then
|
||||
// this returns tesSUCCESS and the check is removed from the
|
||||
// ledger which would mess up later tests.
|
||||
env(check::cash(bob, chkId1, USD(10)), ter(tecNO_LINE));
|
||||
env.close();
|
||||
}
|
||||
|
||||
// bob sets up the trust line, but not at a high enough limit.
|
||||
env(trust(bob, USD(9.5)));
|
||||
env.close();
|
||||
if (!cashCheckMakesTrustLine)
|
||||
{
|
||||
// If cashing a check is allowed to exceed the trust line
|
||||
// limit then this returns tesSUCCESS and the check is
|
||||
// removed from the ledger which would mess up later tests.
|
||||
env(check::cash(bob, chkId1, USD(10)), ter(tecPATH_PARTIAL));
|
||||
env.close();
|
||||
}
|
||||
|
||||
// bob sets the trust line limit high enough but asks for more
|
||||
// than the check's SendMax.
|
||||
@@ -827,34 +808,31 @@ class Check_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 2);
|
||||
BEAST_EXPECT(ownerCount(env, bob) == 1);
|
||||
|
||||
if (cashCheckMakesTrustLine)
|
||||
{
|
||||
// Automatic trust lines are enabled. But one aspect of
|
||||
// automatic trust lines is that they allow the account
|
||||
// cashing a check to exceed their trust line limit. Show
|
||||
// that at work.
|
||||
//
|
||||
// bob's trust line limit is currently USD(10.5). Show that
|
||||
// a payment to bob cannot exceed that trust line, but cashing
|
||||
// a check can.
|
||||
// Automatic trust lines are enabled. But one aspect of
|
||||
// automatic trust lines is that they allow the account
|
||||
// cashing a check to exceed their trust line limit. Show
|
||||
// that at work.
|
||||
//
|
||||
// bob's trust line limit is currently USD(10.5). Show that
|
||||
// a payment to bob cannot exceed that trust line, but cashing
|
||||
// a check can.
|
||||
|
||||
// Payment of 20 USD fails.
|
||||
env(pay(gw, bob, USD(20)), ter(tecPATH_PARTIAL));
|
||||
env.close();
|
||||
// Payment of 20 USD fails.
|
||||
env(pay(gw, bob, USD(20)), ter(tecPATH_PARTIAL));
|
||||
env.close();
|
||||
|
||||
uint256 const chkId20{getCheckIndex(gw, env.seq(gw))};
|
||||
env(check::create(gw, bob, USD(20)));
|
||||
env.close();
|
||||
uint256 const chkId20{getCheckIndex(gw, env.seq(gw))};
|
||||
env(check::create(gw, bob, USD(20)));
|
||||
env.close();
|
||||
|
||||
// However cashing a check for 20 USD succeeds.
|
||||
env(check::cash(bob, chkId20, USD(20)));
|
||||
env.close();
|
||||
env.require(balance(bob, USD(30)));
|
||||
// However cashing a check for 20 USD succeeds.
|
||||
env(check::cash(bob, chkId20, USD(20)));
|
||||
env.close();
|
||||
env.require(balance(bob, USD(30)));
|
||||
|
||||
// Clean up this most recent experiment so the rest of the
|
||||
// tests work.
|
||||
env(pay(bob, gw, USD(20)));
|
||||
}
|
||||
// Clean up this most recent experiment so the rest of the
|
||||
// tests work.
|
||||
env(pay(bob, gw, USD(20)));
|
||||
|
||||
// ... so bob cancels alice's remaining check.
|
||||
env(check::cancel(bob, chkId3));
|
||||
@@ -969,8 +947,7 @@ class Check_test : public beast::unit_test::suite
|
||||
env(check::create(alice, bob, USD(7)));
|
||||
env.close();
|
||||
|
||||
env(check::cash(bob, chkId, USD(7)),
|
||||
ter(cashCheckMakesTrustLine ? tecNO_AUTH : tecNO_LINE));
|
||||
env(check::cash(bob, chkId, USD(7)), ter(tecNO_AUTH));
|
||||
env.close();
|
||||
|
||||
// Now give bob a trustline for USD. bob still can't cash the
|
||||
@@ -985,17 +962,6 @@ class Check_test : public beast::unit_test::suite
|
||||
env(trust(gw, bob["USD"](1)), txflags(tfSetfAuth));
|
||||
env.close();
|
||||
|
||||
// bob tries to cash the check again but fails because his trust
|
||||
// limit is too low.
|
||||
if (!cashCheckMakesTrustLine)
|
||||
{
|
||||
// If cashing a check is allowed to exceed the trust line
|
||||
// limit then this returns tesSUCCESS and the check is
|
||||
// removed from the ledger which would mess up later tests.
|
||||
env(check::cash(bob, chkId, USD(7)), ter(tecPATH_PARTIAL));
|
||||
env.close();
|
||||
}
|
||||
|
||||
// Two possible outcomes here depending on whether cashing a
|
||||
// check can build a trust line:
|
||||
// o If it can't build a trust line, then since bob set his
|
||||
@@ -1004,7 +970,7 @@ class Check_test : public beast::unit_test::suite
|
||||
// o If it can build a trust line, then the check is allowed to
|
||||
// exceed the trust limit and bob gets the full transfer.
|
||||
env(check::cash(bob, chkId, check::DeliverMin(USD(4))));
|
||||
STAmount const bobGot = cashCheckMakesTrustLine ? USD(7) : USD(5);
|
||||
STAmount const bobGot = USD(7);
|
||||
verifyDeliveredAmount(env, bobGot);
|
||||
env.require(balance(alice, USD(8) - bobGot));
|
||||
env.require(balance(bob, bobGot));
|
||||
@@ -1393,15 +1359,6 @@ class Check_test : public beast::unit_test::suite
|
||||
uint256 const chkId{getCheckIndex(alice, env.seq(alice))};
|
||||
env(check::create(alice, bob, USD(20)));
|
||||
env.close();
|
||||
|
||||
if (!features[featureCheckCashMakesTrustLine])
|
||||
{
|
||||
// If cashing a check automatically creates a trustline then
|
||||
// this returns tesSUCCESS and the check is removed from the
|
||||
// ledger which would mess up later tests.
|
||||
env(check::cash(bob, chkId, USD(20)), ter(tecNO_LINE));
|
||||
env.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Now set up bob's trustline.
|
||||
@@ -2003,10 +1960,6 @@ class Check_test : public beast::unit_test::suite
|
||||
{
|
||||
// Explore automatic trust line creation when a check is cashed.
|
||||
//
|
||||
// This capability is enabled by the featureCheckCashMakesTrustLine
|
||||
// amendment. So this test executes only when that amendment is
|
||||
// active.
|
||||
assert(features[featureCheckCashMakesTrustLine]);
|
||||
|
||||
testcase("Trust Line Creation");
|
||||
|
||||
@@ -2707,11 +2660,9 @@ public:
|
||||
{
|
||||
using namespace test::jtx;
|
||||
auto const sa = testable_amendments();
|
||||
testWithFeats(sa - featureCheckCashMakesTrustLine);
|
||||
testWithFeats(sa - disallowIncoming);
|
||||
testWithFeats(sa);
|
||||
|
||||
testTrustLineCreation(sa); // Test with featureCheckCashMakesTrustLine
|
||||
testTrustLineCreation(sa);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -178,14 +178,6 @@ CashCheck::preclaim(PreclaimContext const& ctx)
|
||||
auto const sleTrustLine =
|
||||
ctx.view.read(keylet::line(dstId, issuerId, currency));
|
||||
|
||||
if (!sleTrustLine &&
|
||||
!ctx.view.rules().enabled(featureCheckCashMakesTrustLine))
|
||||
{
|
||||
JLOG(ctx.j.warn())
|
||||
<< "Cannot cash check for IOU without trustline.";
|
||||
return tecNO_LINE;
|
||||
}
|
||||
|
||||
auto const sleIssuer = ctx.view.read(keylet::account(issuerId));
|
||||
if (!sleIssuer)
|
||||
{
|
||||
@@ -344,10 +336,7 @@ CashCheck::doApply()
|
||||
Keylet const trustLineKey = keylet::line(truster, trustLineIssue);
|
||||
bool const destLow = issuer > account_;
|
||||
|
||||
bool const checkCashMakesTrustLine =
|
||||
psb.rules().enabled(featureCheckCashMakesTrustLine);
|
||||
|
||||
if (checkCashMakesTrustLine && !psb.exists(trustLineKey))
|
||||
if (!psb.exists(trustLineKey))
|
||||
{
|
||||
// 1. Can the check casher meet the reserve for the trust line?
|
||||
// 2. Create trust line between destination (this) account
|
||||
@@ -420,14 +409,11 @@ CashCheck::doApply()
|
||||
sleTrustLine->at(tweakedLimit) = savedLimit;
|
||||
});
|
||||
|
||||
if (checkCashMakesTrustLine)
|
||||
{
|
||||
// Set the trust line limit to the highest possible value
|
||||
// while flow runs.
|
||||
STAmount const bigAmount(
|
||||
trustLineIssue, STAmount::cMaxValue, STAmount::cMaxOffset);
|
||||
sleTrustLine->at(tweakedLimit) = bigAmount;
|
||||
}
|
||||
// Set the trust line limit to the highest possible value
|
||||
// while flow runs.
|
||||
STAmount const bigAmount(
|
||||
trustLineIssue, STAmount::cMaxValue, STAmount::cMaxOffset);
|
||||
sleTrustLine->at(tweakedLimit) = bigAmount;
|
||||
|
||||
// Let flow() do the heavy lifting on a check for an IOU.
|
||||
auto const result = flow(
|
||||
@@ -460,15 +446,11 @@ CashCheck::doApply()
|
||||
<< "flow did not produce DeliverMin.";
|
||||
return tecPATH_PARTIAL;
|
||||
}
|
||||
if (!checkCashMakesTrustLine)
|
||||
// Set the delivered_amount metadata.
|
||||
ctx_.deliver(result.actualAmountOut);
|
||||
}
|
||||
|
||||
// Set the delivered amount metadata in all cases, not just
|
||||
// for DeliverMin.
|
||||
if (checkCashMakesTrustLine)
|
||||
ctx_.deliver(result.actualAmountOut);
|
||||
ctx_.deliver(result.actualAmountOut);
|
||||
|
||||
sleCheck = psb.peek(keylet::check(ctx_.tx[sfCheckID]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user