PayChan and Escrow should ignore DisallowXRP (RIPD-1462)

This commit is contained in:
Scott Schurr
2017-10-02 18:33:22 -07:00
committed by Nikolaos D. Bougalis
parent 259394029a
commit cc0ce7163a
4 changed files with 79 additions and 25 deletions

View File

@@ -253,6 +253,35 @@ struct Escrow_test : public beast::unit_test::suite
BEAST_EXPECT((*sle)[sfDestinationTag] == 2);
}
void
testDisallowXRP()
{
testcase ("Disallow XRP");
using namespace jtx;
using namespace std::chrono;
{
// Respect the "asfDisallowXRP" account flag:
Env env(*this, supported_amendments() - featureDepositAuth);
env.fund(XRP(5000), "bob", "george");
env(fset("george", asfDisallowXRP));
env(lockup("bob", "george", XRP(10), env.now() + 1s),
ter (tecNO_TARGET));
}
{
// Ignore the "asfDisallowXRP" account flag, which we should
// have been doing before.
Env env(*this);
env.fund(XRP(5000), "bob", "george");
env(fset("george", asfDisallowXRP));
env(lockup("bob", "george", XRP(10), env.now() + 1s));
}
}
void
testFails()
{
@@ -331,11 +360,6 @@ struct Escrow_test : public beast::unit_test::suite
env.fund (accountReserve, "frank");
env(lockup("frank", "bob", XRP(1), env.now() + 1s), ter (tecINSUFFICIENT_RESERVE));
// Respect the "asfDisallowXRP" account flag:
env.fund (accountReserve + accountIncrement, "george");
env(fset("george", asfDisallowXRP));
env(lockup("bob", "george", XRP(10), env.now() + 1s), ter (tecNO_TARGET));
{ // Specify incorrect sequence number
env.fund (XRP(5000), "hannah");
auto const seq = env.seq("hannah");
@@ -980,6 +1004,7 @@ struct Escrow_test : public beast::unit_test::suite
{
testEnablement();
testTags();
testDisallowXRP();
testFails();
testLockup();
testEscrowConditions();