mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
refactor: Restructure Transactor::preflight to reduce boilerplate (#5592)
* Restructures `Transactor::preflight` to create several functions that will remove the need for error-prone boilerplate code in derived classes' implementations of `preflight`.
This commit is contained in:
@@ -26,22 +26,19 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::uint32_t
|
||||
MPTokenAuthorize::getFlagsMask(PreflightContext const& ctx)
|
||||
{
|
||||
return tfMPTokenAuthorizeMask;
|
||||
}
|
||||
|
||||
NotTEC
|
||||
MPTokenAuthorize::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
if (!ctx.rules.enabled(featureMPTokensV1))
|
||||
return temDISABLED;
|
||||
|
||||
if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
|
||||
return ret;
|
||||
|
||||
if (ctx.tx.getFlags() & tfMPTokenAuthorizeMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
if (ctx.tx[sfAccount] == ctx.tx[~sfHolder])
|
||||
return temMALFORMED;
|
||||
|
||||
return preflight2(ctx);
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER
|
||||
|
||||
Reference in New Issue
Block a user