Remove conditionals for featureEscrow enabled 31Mar2017

This commit is contained in:
Scott Schurr
2020-02-27 15:31:13 -08:00
parent e93a44fe9b
commit c8282795ef
5 changed files with 28 additions and 47 deletions

View File

@@ -98,9 +98,6 @@ EscrowCreate::calculateMaxSpend(STTx const& tx)
NotTEC
EscrowCreate::preflight (PreflightContext const& ctx)
{
if (! ctx.rules.enabled(featureEscrow))
return temDISABLED;
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
return temINVALID_FLAG;
@@ -300,9 +297,6 @@ checkCondition (Slice f, Slice c)
NotTEC
EscrowFinish::preflight (PreflightContext const& ctx)
{
if (! ctx.rules.enabled(featureEscrow))
return temDISABLED;
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
return temINVALID_FLAG;
@@ -518,9 +512,6 @@ EscrowFinish::doApply()
NotTEC
EscrowCancel::preflight (PreflightContext const& ctx)
{
if (! ctx.rules.enabled(featureEscrow))
return temDISABLED;
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
return temINVALID_FLAG;

View File

@@ -372,7 +372,7 @@ extern uint256 const featureFlowCross;
extern uint256 const retiredCryptoConditions;
extern uint256 const retiredTickSize;
extern uint256 const retiredFix1368;
extern uint256 const featureEscrow;
extern uint256 const retiredEscrow;
extern uint256 const featureCryptoConditionsSuite;
extern uint256 const fix1373;
extern uint256 const featureEnforceInvariants;

View File

@@ -163,7 +163,7 @@ uint256 const featureFlowCross = *getRegisteredFeature("FlowCross");
uint256 const retiredCryptoConditions = *getRegisteredFeature("CryptoConditions");
uint256 const retiredTickSize = *getRegisteredFeature("TickSize");
uint256 const retiredFix1368 = *getRegisteredFeature("fix1368");
uint256 const featureEscrow = *getRegisteredFeature("Escrow");
uint256 const retiredEscrow = *getRegisteredFeature("Escrow");
uint256 const featureCryptoConditionsSuite = *getRegisteredFeature("CryptoConditionsSuite");
uint256 const fix1373 = *getRegisteredFeature("fix1373");
uint256 const featureEnforceInvariants = *getRegisteredFeature("EnforceInvariants");

View File

@@ -215,36 +215,25 @@ struct Escrow_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::chrono;
{ // Escrow not enabled
Env env(*this, supported_amendments() - featureEscrow);
env.fund(XRP(5000), "alice", "bob");
env(escrow("alice", "bob", XRP(1000)),
finish_time(env.now() + 1s), ter(temDISABLED));
env(finish("bob", "alice", 1), ter(temDISABLED));
env(cancel("bob", "alice", 1), ter(temDISABLED));
}
Env env(*this);
env.fund(XRP(5000), "alice", "bob");
env(escrow("alice", "bob", XRP(1000)), finish_time(env.now() + 1s));
env.close();
{ // Escrow enabled
Env env(*this);
env.fund(XRP(5000), "alice", "bob");
env(escrow("alice", "bob", XRP(1000)), finish_time(env.now() + 1s));
env.close();
auto const seq1 = env.seq("alice");
auto const seq1 = env.seq("alice");
env(escrow("alice", "bob", XRP(1000)), condition (cb1),
finish_time(env.now() + 1s), fee(1500));
env.close();
env(finish("bob", "alice", seq1),
condition(cb1), fulfillment(fb1), fee(1500));
env(escrow("alice", "bob", XRP(1000)), condition (cb1),
finish_time(env.now() + 1s), fee(1500));
env.close();
env(finish("bob", "alice", seq1),
condition(cb1), fulfillment(fb1), fee(1500));
auto const seq2 = env.seq("alice");
auto const seq2 = env.seq("alice");
env(escrow("alice", "bob", XRP(1000)), condition(cb2),
finish_time(env.now() + 1s), cancel_time(env.now() + 2s), fee(1500));
env.close();
env(cancel("bob", "alice", seq2), fee(1500));
}
env(escrow("alice", "bob", XRP(1000)), condition(cb2),
finish_time(env.now() + 1s), cancel_time(env.now() + 2s), fee(1500));
env.close();
env(cancel("bob", "alice", seq2), fee(1500));
}
void

View File

@@ -748,23 +748,23 @@ public:
{
// a Env FeatureBitset has *only* those features
Env env{*this, FeatureBitset(featureEscrow, featureFlow)};
Env env{*this, FeatureBitset(featureMultiSignReserve, featureFlow)};
BEAST_EXPECT(env.app().config().features.size() == 2);
foreachFeature(supported, [&](uint256 const& f) {
bool const has = (f == featureEscrow || f == featureFlow);
bool const has = (f == featureMultiSignReserve || f == featureFlow);
this->BEAST_EXPECT(has == hasFeature(env, f));
});
}
auto const noFlowOrEscrow =
supported_amendments() - featureEscrow - featureFlow;
auto const missingSomeFeatures =
supported_amendments() - featureMultiSignReserve - featureFlow;
{
// a Env supported_features_except is missing *only* those features
Env env{*this, noFlowOrEscrow};
Env env{*this, missingSomeFeatures};
BEAST_EXPECT(
env.app().config().features.size() == (supported.count() - 2));
foreachFeature(supported, [&](uint256 const& f) {
bool hasnot = (f == featureEscrow || f == featureFlow);
bool hasnot = (f == featureMultiSignReserve || f == featureFlow);
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
});
}
@@ -776,7 +776,8 @@ public:
// the two supported ones
Env env{
*this,
FeatureBitset(featureEscrow, featureFlow, *neverSupportedFeat)};
FeatureBitset(
featureMultiSignReserve, featureFlow, *neverSupportedFeat)};
// this app will have just 2 supported amendments and
// one additional never supported feature flag
@@ -784,7 +785,7 @@ public:
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
foreachFeature(supported, [&](uint256 const& f) {
bool has = (f == featureEscrow || f == featureFlow);
bool has = (f == featureMultiSignReserve || f == featureFlow);
this->BEAST_EXPECT(has == hasFeature(env, f));
});
}
@@ -794,7 +795,7 @@ public:
// and omit a few standard amendments
// the unsupported features should be enabled
Env env{*this,
noFlowOrEscrow | FeatureBitset{*neverSupportedFeat}};
missingSomeFeatures | FeatureBitset{*neverSupportedFeat}};
// this app will have all supported amendments minus 2 and then the
// one additional never supported feature flag
@@ -803,7 +804,7 @@ public:
(supported.count() - 2 + 1));
BEAST_EXPECT(hasFeature(env, *neverSupportedFeat));
foreachFeature(supported, [&](uint256 const& f) {
bool hasnot = (f == featureEscrow || f == featureFlow);
bool hasnot = (f == featureMultiSignReserve || f == featureFlow);
this->BEAST_EXPECT(hasnot != hasFeature(env, f));
});
}