New rules for payment paths:

* Sanity check on newly created strands
* Better loop detection
* Better tests (test every combination of path element pairs)
* Disallow any root issuer (even for xrp)
* Disallow compount element typs in path
* Issue was not reset when currency was XRP
* Add amendment
This commit is contained in:
seelabs
2017-02-08 13:24:36 -05:00
committed by Scott Schurr
parent 80d9b0464a
commit 846723d771
27 changed files with 2172 additions and 646 deletions

View File

@@ -17,6 +17,7 @@
*/
//==============================================================================
#include <test/jtx.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/TxFlags.h>
#include <ripple/protocol/JsonFields.h>
#include <ripple/protocol/SField.h>
@@ -52,12 +53,12 @@ class Freeze_test : public beast::unit_test::suite
return val.isArray() && val.size() == size;
}
void testRippleState()
void testRippleState(std::initializer_list<uint256> fs)
{
testcase("RippleState Freeze");
using namespace test::jtx;
Env env(*this);
Env env(*this, features(fs));
Account G1 {"G1"};
Account alice {"alice"};
@@ -206,12 +207,12 @@ class Freeze_test : public beast::unit_test::suite
}
void
testGlobalFreeze()
testGlobalFreeze(std::initializer_list<uint256> fs)
{
testcase("Global Freeze");
using namespace test::jtx;
Env env(*this);
Env env(*this, features(fs));
Account G1 {"G1"};
Account A1 {"A1"};
@@ -364,12 +365,12 @@ class Freeze_test : public beast::unit_test::suite
}
void
testNoFreeze()
testNoFreeze(std::initializer_list<uint256> fs)
{
testcase("No Freeze");
using namespace test::jtx;
Env env(*this);
Env env(*this, features(fs));
Account G1 {"G1"};
Account A1 {"A1"};
@@ -418,12 +419,12 @@ class Freeze_test : public beast::unit_test::suite
}
void
testOffersWhenFrozen()
testOffersWhenFrozen(std::initializer_list<uint256> fs)
{
testcase("Offers for Frozen Trust Lines");
using namespace test::jtx;
Env env(*this);
Env env(*this, features(fs));
Account G1 {"G1"};
Account A2 {"A2"};
@@ -522,10 +523,16 @@ public:
void run()
{
testRippleState();
testGlobalFreeze();
testNoFreeze();
testOffersWhenFrozen();
auto testAll = [this](std::initializer_list<uint256> fs)
{
testRippleState(fs);
testGlobalFreeze(fs);
testNoFreeze(fs);
testOffersWhenFrozen(fs);
};
testAll({});
testAll({featureFlow});
testAll({featureFlow, featureToStrandV2});
}
};