mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 12:35:50 +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_FIX (TrustLinesToSelf, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FEATURE(NonFungibleTokensV1_1, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(NonFungibleTokensV1_1, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FEATURE(ExpandedSignerList, 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(FlowSortStrands, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(TicketBatch, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FEATURE(TicketBatch, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
XRPL_FEATURE(NegativeUNL, Supported::yes, VoteBehavior::DefaultYes)
|
XRPL_FEATURE(NegativeUNL, Supported::yes, VoteBehavior::DefaultYes)
|
||||||
@@ -154,3 +153,4 @@ XRPL_RETIRE(PayChan)
|
|||||||
XRPL_RETIRE(SortedDirectories)
|
XRPL_RETIRE(SortedDirectories)
|
||||||
XRPL_RETIRE(TickSize)
|
XRPL_RETIRE(TickSize)
|
||||||
XRPL_RETIRE(TrustSetAuth)
|
XRPL_RETIRE(TrustSetAuth)
|
||||||
|
XRPL_RETIRE(CheckCashMakesTrustLine)
|
||||||
|
|||||||
@@ -698,9 +698,6 @@ class Check_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
using namespace test::jtx;
|
using namespace test::jtx;
|
||||||
|
|
||||||
bool const cashCheckMakesTrustLine =
|
|
||||||
features[featureCheckCashMakesTrustLine];
|
|
||||||
|
|
||||||
Account const gw{"gateway"};
|
Account const gw{"gateway"};
|
||||||
Account const alice{"alice"};
|
Account const alice{"alice"};
|
||||||
Account const bob{"bob"};
|
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.
|
// and fails because he hasn't got a trust line for USD.
|
||||||
env(pay(gw, alice, USD(0.5)));
|
env(pay(gw, alice, USD(0.5)));
|
||||||
env.close();
|
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.
|
// bob sets up the trust line, but not at a high enough limit.
|
||||||
env(trust(bob, USD(9.5)));
|
env(trust(bob, USD(9.5)));
|
||||||
env.close();
|
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
|
// bob sets the trust line limit high enough but asks for more
|
||||||
// than the check's SendMax.
|
// than the check's SendMax.
|
||||||
@@ -827,8 +808,6 @@ class Check_test : public beast::unit_test::suite
|
|||||||
BEAST_EXPECT(ownerCount(env, alice) == 2);
|
BEAST_EXPECT(ownerCount(env, alice) == 2);
|
||||||
BEAST_EXPECT(ownerCount(env, bob) == 1);
|
BEAST_EXPECT(ownerCount(env, bob) == 1);
|
||||||
|
|
||||||
if (cashCheckMakesTrustLine)
|
|
||||||
{
|
|
||||||
// Automatic trust lines are enabled. But one aspect of
|
// Automatic trust lines are enabled. But one aspect of
|
||||||
// automatic trust lines is that they allow the account
|
// automatic trust lines is that they allow the account
|
||||||
// cashing a check to exceed their trust line limit. Show
|
// cashing a check to exceed their trust line limit. Show
|
||||||
@@ -854,7 +833,6 @@ class Check_test : public beast::unit_test::suite
|
|||||||
// Clean up this most recent experiment so the rest of the
|
// Clean up this most recent experiment so the rest of the
|
||||||
// tests work.
|
// tests work.
|
||||||
env(pay(bob, gw, USD(20)));
|
env(pay(bob, gw, USD(20)));
|
||||||
}
|
|
||||||
|
|
||||||
// ... so bob cancels alice's remaining check.
|
// ... so bob cancels alice's remaining check.
|
||||||
env(check::cancel(bob, chkId3));
|
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(check::create(alice, bob, USD(7)));
|
||||||
env.close();
|
env.close();
|
||||||
|
|
||||||
env(check::cash(bob, chkId, USD(7)),
|
env(check::cash(bob, chkId, USD(7)), ter(tecNO_AUTH));
|
||||||
ter(cashCheckMakesTrustLine ? tecNO_AUTH : tecNO_LINE));
|
|
||||||
env.close();
|
env.close();
|
||||||
|
|
||||||
// Now give bob a trustline for USD. bob still can't cash the
|
// 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(trust(gw, bob["USD"](1)), txflags(tfSetfAuth));
|
||||||
env.close();
|
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
|
// Two possible outcomes here depending on whether cashing a
|
||||||
// check can build a trust line:
|
// check can build a trust line:
|
||||||
// o If it can't build a trust line, then since bob set his
|
// 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
|
// o If it can build a trust line, then the check is allowed to
|
||||||
// exceed the trust limit and bob gets the full transfer.
|
// exceed the trust limit and bob gets the full transfer.
|
||||||
env(check::cash(bob, chkId, check::DeliverMin(USD(4))));
|
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);
|
verifyDeliveredAmount(env, bobGot);
|
||||||
env.require(balance(alice, USD(8) - bobGot));
|
env.require(balance(alice, USD(8) - bobGot));
|
||||||
env.require(balance(bob, 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))};
|
uint256 const chkId{getCheckIndex(alice, env.seq(alice))};
|
||||||
env(check::create(alice, bob, USD(20)));
|
env(check::create(alice, bob, USD(20)));
|
||||||
env.close();
|
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.
|
// 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.
|
// 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");
|
testcase("Trust Line Creation");
|
||||||
|
|
||||||
@@ -2707,11 +2660,9 @@ public:
|
|||||||
{
|
{
|
||||||
using namespace test::jtx;
|
using namespace test::jtx;
|
||||||
auto const sa = testable_amendments();
|
auto const sa = testable_amendments();
|
||||||
testWithFeats(sa - featureCheckCashMakesTrustLine);
|
|
||||||
testWithFeats(sa - disallowIncoming);
|
testWithFeats(sa - disallowIncoming);
|
||||||
testWithFeats(sa);
|
testWithFeats(sa);
|
||||||
|
testTrustLineCreation(sa);
|
||||||
testTrustLineCreation(sa); // Test with featureCheckCashMakesTrustLine
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -178,14 +178,6 @@ CashCheck::preclaim(PreclaimContext const& ctx)
|
|||||||
auto const sleTrustLine =
|
auto const sleTrustLine =
|
||||||
ctx.view.read(keylet::line(dstId, issuerId, currency));
|
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));
|
auto const sleIssuer = ctx.view.read(keylet::account(issuerId));
|
||||||
if (!sleIssuer)
|
if (!sleIssuer)
|
||||||
{
|
{
|
||||||
@@ -344,10 +336,7 @@ CashCheck::doApply()
|
|||||||
Keylet const trustLineKey = keylet::line(truster, trustLineIssue);
|
Keylet const trustLineKey = keylet::line(truster, trustLineIssue);
|
||||||
bool const destLow = issuer > account_;
|
bool const destLow = issuer > account_;
|
||||||
|
|
||||||
bool const checkCashMakesTrustLine =
|
if (!psb.exists(trustLineKey))
|
||||||
psb.rules().enabled(featureCheckCashMakesTrustLine);
|
|
||||||
|
|
||||||
if (checkCashMakesTrustLine && !psb.exists(trustLineKey))
|
|
||||||
{
|
{
|
||||||
// 1. Can the check casher meet the reserve for the trust line?
|
// 1. Can the check casher meet the reserve for the trust line?
|
||||||
// 2. Create trust line between destination (this) account
|
// 2. Create trust line between destination (this) account
|
||||||
@@ -420,14 +409,11 @@ CashCheck::doApply()
|
|||||||
sleTrustLine->at(tweakedLimit) = savedLimit;
|
sleTrustLine->at(tweakedLimit) = savedLimit;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (checkCashMakesTrustLine)
|
|
||||||
{
|
|
||||||
// Set the trust line limit to the highest possible value
|
// Set the trust line limit to the highest possible value
|
||||||
// while flow runs.
|
// while flow runs.
|
||||||
STAmount const bigAmount(
|
STAmount const bigAmount(
|
||||||
trustLineIssue, STAmount::cMaxValue, STAmount::cMaxOffset);
|
trustLineIssue, STAmount::cMaxValue, STAmount::cMaxOffset);
|
||||||
sleTrustLine->at(tweakedLimit) = bigAmount;
|
sleTrustLine->at(tweakedLimit) = bigAmount;
|
||||||
}
|
|
||||||
|
|
||||||
// Let flow() do the heavy lifting on a check for an IOU.
|
// Let flow() do the heavy lifting on a check for an IOU.
|
||||||
auto const result = flow(
|
auto const result = flow(
|
||||||
@@ -460,14 +446,10 @@ CashCheck::doApply()
|
|||||||
<< "flow did not produce DeliverMin.";
|
<< "flow did not produce DeliverMin.";
|
||||||
return tecPATH_PARTIAL;
|
return tecPATH_PARTIAL;
|
||||||
}
|
}
|
||||||
if (!checkCashMakesTrustLine)
|
|
||||||
// Set the delivered_amount metadata.
|
|
||||||
ctx_.deliver(result.actualAmountOut);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the delivered amount metadata in all cases, not just
|
// Set the delivered amount metadata in all cases, not just
|
||||||
// for DeliverMin.
|
// for DeliverMin.
|
||||||
if (checkCashMakesTrustLine)
|
|
||||||
ctx_.deliver(result.actualAmountOut);
|
ctx_.deliver(result.actualAmountOut);
|
||||||
|
|
||||||
sleCheck = psb.peek(keylet::check(ctx_.tx[sfCheckID]));
|
sleCheck = psb.peek(keylet::check(ctx_.tx[sfCheckID]));
|
||||||
|
|||||||
Reference in New Issue
Block a user