mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-05 11:45:51 +00:00
Improve checking of transaction flags (RIPD-1543)
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -32,6 +33,9 @@ CancelTicket::preflight (PreflightContext const& ctx)
|
||||
if (! ctx.rules.enabled(featureTickets))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
auto const ret = preflight1 (ctx);
|
||||
if (!isTesSuccess (ret))
|
||||
return ret;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -32,6 +33,9 @@ CreateTicket::preflight (PreflightContext const& ctx)
|
||||
if (! ctx.rules.enabled(featureTickets))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
auto const ret = preflight1 (ctx);
|
||||
if (!isTesSuccess (ret))
|
||||
return ret;
|
||||
|
||||
@@ -99,6 +99,9 @@ EscrowCreate::preflight (PreflightContext const& ctx)
|
||||
if (! ctx.rules.enabled(featureEscrow))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
auto const ret = preflight1 (ctx);
|
||||
if (!isTesSuccess (ret))
|
||||
return ret;
|
||||
@@ -297,6 +300,9 @@ EscrowFinish::preflight (PreflightContext const& ctx)
|
||||
if (! ctx.rules.enabled(featureEscrow))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
{
|
||||
auto const ret = preflight1 (ctx);
|
||||
if (!isTesSuccess (ret))
|
||||
@@ -504,6 +510,9 @@ EscrowCancel::preflight (PreflightContext const& ctx)
|
||||
if (! ctx.rules.enabled(featureEscrow))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
auto const ret = preflight1 (ctx);
|
||||
if (!isTesSuccess (ret))
|
||||
return ret;
|
||||
|
||||
@@ -161,6 +161,9 @@ PayChanCreate::preflight (PreflightContext const& ctx)
|
||||
if (!ctx.rules.enabled (featurePayChan))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
auto const ret = preflight1 (ctx);
|
||||
if (!isTesSuccess (ret))
|
||||
return ret;
|
||||
@@ -266,6 +269,9 @@ PayChanFund::preflight (PreflightContext const& ctx)
|
||||
if (!ctx.rules.enabled (featurePayChan))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
auto const ret = preflight1 (ctx);
|
||||
if (!isTesSuccess (ret))
|
||||
return ret;
|
||||
@@ -370,9 +376,15 @@ PayChanClaim::preflight (PreflightContext const& ctx)
|
||||
return tecNO_PERMISSION;
|
||||
}
|
||||
|
||||
auto const flags = ctx.tx.getFlags ();
|
||||
{
|
||||
auto const flags = ctx.tx.getFlags();
|
||||
|
||||
if (ctx.rules.enabled(fix1543) && (flags & tfPayChanClaimMask))
|
||||
return temINVALID_FLAG;
|
||||
|
||||
if ((flags & tfClose) && (flags & tfRenew))
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (auto const sig = ctx.tx[~sfSignature])
|
||||
{
|
||||
|
||||
@@ -76,7 +76,8 @@ class FeatureCollections
|
||||
"fix1528",
|
||||
"DepositAuth",
|
||||
"Checks",
|
||||
"fix1571"
|
||||
"fix1571",
|
||||
"fix1543",
|
||||
};
|
||||
|
||||
std::vector<uint256> features;
|
||||
@@ -359,6 +360,7 @@ extern uint256 const fix1528;
|
||||
extern uint256 const featureDepositAuth;
|
||||
extern uint256 const featureChecks;
|
||||
extern uint256 const fix1571;
|
||||
extern uint256 const fix1543;
|
||||
|
||||
} // ripple
|
||||
|
||||
|
||||
@@ -96,9 +96,10 @@ const std::uint32_t tfTrustSetMask = ~ (tfUniversal | tfSetfAuth | tfSet
|
||||
const std::uint32_t tfGotMajority = 0x00010000;
|
||||
const std::uint32_t tfLostMajority = 0x00020000;
|
||||
|
||||
// PaymentChannel flags:
|
||||
// PaymentChannelClaim flags:
|
||||
const std::uint32_t tfRenew = 0x00010000;
|
||||
const std::uint32_t tfClose = 0x00020000;
|
||||
const std::uint32_t tfPayChanClaimMask = ~ (tfUniversal | tfRenew | tfClose);
|
||||
|
||||
} // ripple
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ detail::supportedAmendments ()
|
||||
{ "1D3463A5891F9E589C5AE839FFAC4A917CE96197098A1EF22304E1BC5B98A454 fix1528" },
|
||||
{ "F64E1EABBE79D55B3BB82020516CEC2C582A98A6BFE20FBE9BB6A0D233418064 DepositAuth"},
|
||||
{ "157D2D480E006395B76F948E3E07A45A05FE10230D88A7993C71F97AE4B1F2D1 Checks"},
|
||||
{ "7117E2EC2DBF119CA55181D69819F1999ECEE1A0225A7FD2B9ED47940968479C fix1571" }
|
||||
{ "7117E2EC2DBF119CA55181D69819F1999ECEE1A0225A7FD2B9ED47940968479C fix1571" },
|
||||
{ "CA7C02118BA27599528543DFE77BA6838D1B0F43B447D4D7F53523CE6A0E9AC2 fix1543" }
|
||||
};
|
||||
return supported;
|
||||
}
|
||||
@@ -160,5 +161,6 @@ uint256 const fix1528 = *getRegisteredFeature("fix1528");
|
||||
uint256 const featureDepositAuth = *getRegisteredFeature("DepositAuth");
|
||||
uint256 const featureChecks = *getRegisteredFeature("Checks");
|
||||
uint256 const fix1571 = *getRegisteredFeature("fix1571");
|
||||
uint256 const fix1543 = *getRegisteredFeature("fix1543");
|
||||
|
||||
} // ripple
|
||||
|
||||
Reference in New Issue
Block a user