mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 01:06:48 +00:00
fix L18
This commit is contained in:
@@ -160,16 +160,28 @@ Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
if (!hasSponsor && hasSponsorFlags)
|
||||
if (!hasSponsor)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "preflight1: sponsor flags without sponsor definition";
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
if (hasSponsorFlags)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "preflight1: sponsor flags without sponsor definition";
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
if (!hasSponsor && hasSponsorSig)
|
||||
if (hasSponsorSig)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "preflight1: sponsor signature without sponsor definition";
|
||||
return temMALFORMED;
|
||||
}
|
||||
}
|
||||
else if (hasSponsorFlags)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "preflight1: sponsor signature without sponsor definition";
|
||||
return temMALFORMED;
|
||||
auto const sponsorFlags = ctx.tx.getFieldU32(sfSponsorFlags);
|
||||
if ((sponsorFlags & ~(spfSponsorFee | spfSponsorReserve)) || sponsorFlags == 0)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "preflight1: invalid sponsor flags";
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto const ret = preflight0(ctx, flagMask))
|
||||
@@ -218,6 +230,13 @@ Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
// if (hasSponsor && hasSponsorFlags &&
|
||||
// ctx.tx.getFieldU32(sfSponsorFlags) == 0)
|
||||
// {
|
||||
// JLOG(ctx.j.debug()) << "preflight1: sponsor with no sponsorship flags";
|
||||
// return temINVALID_FLAG;
|
||||
// }
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
env.close();
|
||||
|
||||
// Invalid Sponsor Account (Account = Sponsor.Account)
|
||||
env(noop(alice), sponsor::as(alice), ter(temMALFORMED));
|
||||
env(noop(alice), sponsor::as(alice, spfSponsorFee), ter(temMALFORMED));
|
||||
|
||||
// Invalid Sponsor Account
|
||||
// (SponsorSignature is specified but Sponsor.Account is not specified)
|
||||
@@ -378,6 +378,9 @@ public:
|
||||
sponsor::as(sponsor, (spfSponsorFee | spfSponsorReserve) + 1),
|
||||
ter(temINVALID_FLAG));
|
||||
|
||||
// SponsorFlags=0 with valid sponsor (no sponsorship purpose)
|
||||
env(noop(alice), sponsor::as(sponsor, 0), ter(temINVALID_FLAG));
|
||||
|
||||
// Invalid Flags without sponsor
|
||||
auto tx = noop(alice);
|
||||
tx[sfSponsorFlags.jsonName] = spfSponsorFee | spfSponsorReserve;
|
||||
|
||||
Reference in New Issue
Block a user