mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 09:16:47 +00:00
address 5594, 5592 changes
This commit is contained in:
@@ -227,7 +227,7 @@ public:
|
||||
fee(XRP(1)),
|
||||
sponsor::as(invalid, tfSponsorReserve),
|
||||
sponsor::sig(invalid),
|
||||
ter(tefBAD_AUTH));
|
||||
ter(terNO_ACCOUNT));
|
||||
|
||||
// Success
|
||||
env(noop(alice),
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
fee(XRP(1)),
|
||||
sponsor::as(invalid, tfSponsorReserve),
|
||||
sponsor::msig({signer1}),
|
||||
ter(tefBAD_AUTH));
|
||||
ter(tefNOT_MULTI_SIGNING));
|
||||
|
||||
env(noop(alice),
|
||||
fee(XRP(1)),
|
||||
|
||||
@@ -25,20 +25,17 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::uint32_t
|
||||
SponsorshipSet::getFlagsMask(PreflightContext const& ctx)
|
||||
{
|
||||
return tfSponsorshipSetMask;
|
||||
}
|
||||
|
||||
NotTEC
|
||||
SponsorshipSet::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
if (!ctx.rules.enabled(featureSponsor))
|
||||
return temDISABLED;
|
||||
|
||||
if (auto const ter = preflight1(ctx))
|
||||
return ter;
|
||||
|
||||
// check Flags
|
||||
{
|
||||
if (ctx.tx.isFlag(tfSponsorshipSetMask))
|
||||
return temINVALID_FLAG;
|
||||
|
||||
if (ctx.tx.isFlag(tfSponsorshipSetRequireSignForFee) &&
|
||||
ctx.tx.isFlag(tfSponsorshipClearRequireSignForFee))
|
||||
return temINVALID_FLAG;
|
||||
@@ -123,7 +120,7 @@ SponsorshipSet::preflight(PreflightContext const& ctx)
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
return preflight2(ctx);
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER
|
||||
|
||||
@@ -33,6 +33,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
static std::uint32_t
|
||||
getFlagsMask(PreflightContext const& ctx);
|
||||
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
|
||||
@@ -34,16 +34,7 @@ namespace ripple {
|
||||
NotTEC
|
||||
SponsorshipTransfer::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
if (!ctx.rules.enabled(featureSponsor))
|
||||
return temDISABLED;
|
||||
|
||||
if (auto const ter = preflight1(ctx))
|
||||
return ter;
|
||||
|
||||
if (ctx.tx.getFlags() & tfUniversalMask)
|
||||
return temINVALID_FLAG;
|
||||
|
||||
return preflight2(ctx);
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -786,26 +786,28 @@ Transactor::checkSign(
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
// If the pk is empty and not simulate or simulate and signers,
|
||||
// then we must be multi-signing.
|
||||
if (ctx.tx.isFieldPresent(sfSigners))
|
||||
if (sigObject.isFieldPresent(sfSponsor))
|
||||
{
|
||||
return checkMultiSign(ctx, idAccount, sigObject);
|
||||
}
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfSponsor))
|
||||
{
|
||||
auto const sponsorObj = ctx.tx.getFieldObject(sfSponsor);
|
||||
auto const sponsorObj = sigObject.getFieldObject(sfSponsor);
|
||||
auto const isCoSigned = sponsorObj.isFieldPresent(sfTxnSignature) ||
|
||||
!sponsorObj.getFieldVL(sfSigningPubKey).empty() ||
|
||||
sponsorObj.isFieldPresent(sfSigners);
|
||||
if (isCoSigned)
|
||||
{
|
||||
if (auto const ret = checkSponsorSign(ctx); !isTesSuccess(ret))
|
||||
auto const sponsorAcc = sponsorObj.getAccountID(sfAccount);
|
||||
if (auto const ret = checkSign(ctx, sponsorAcc, sponsorObj);
|
||||
!isTesSuccess(ret))
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// If the pk is empty and not simulate or simulate and signers,
|
||||
// then we must be multi-signing.
|
||||
if (sigObject.isFieldPresent(sfSigners))
|
||||
{
|
||||
return checkMultiSign(ctx, idAccount, sigObject);
|
||||
}
|
||||
|
||||
// Check Single Sign
|
||||
XRPL_ASSERT(
|
||||
!pkSigner.empty(), "ripple::Transactor::checkSign : non-empty signer");
|
||||
@@ -880,52 +882,6 @@ Transactor::checkBatchSign(PreclaimContext const& ctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
NotTEC
|
||||
Transactor::checkSponsorSign(PreclaimContext const& ctx)
|
||||
{
|
||||
NotTEC ret = tesSUCCESS;
|
||||
|
||||
if (!ctx.tx.isFieldPresent(sfSponsor))
|
||||
return tesSUCCESS;
|
||||
|
||||
auto const sponsorObj = ctx.tx.getFieldObject(sfSponsor);
|
||||
|
||||
auto const sponsorAcc = sponsorObj.getAccountID(sfAccount);
|
||||
Blob const& pkSigner = sponsorObj.getFieldVL(sfSigningPubKey);
|
||||
|
||||
auto const sleAccount = ctx.view.read(keylet::account(sponsorAcc));
|
||||
if (!sleAccount)
|
||||
return tefBAD_AUTH;
|
||||
|
||||
if (pkSigner.empty())
|
||||
{
|
||||
STArray const& txSigners(sponsorObj.getFieldArray(sfSigners));
|
||||
for (auto const& txSigner : txSigners)
|
||||
{
|
||||
if (ret = checkMultiSign(ctx, sponsorAcc, txSigner);
|
||||
!isTesSuccess(ret))
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
if (!publicKeyType(makeSlice(pkSigner)))
|
||||
return tefBAD_AUTH;
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
auto const idSigner = calcAccountID(PublicKey(makeSlice(pkSigner)));
|
||||
|
||||
if (ret = checkSingleSign(ctx, idSigner, sponsorAcc, sleAccount);
|
||||
!isTesSuccess(ret))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
NotTEC
|
||||
Transactor::checkSingleSign(
|
||||
PreclaimContext const& ctx,
|
||||
|
||||
@@ -210,9 +210,6 @@ public:
|
||||
static NotTEC
|
||||
checkBatchSign(PreclaimContext const& ctx);
|
||||
|
||||
static NotTEC
|
||||
checkSponsorSign(PreclaimContext const& ctx);
|
||||
|
||||
// Returns the fee in fee units, not scaled for load.
|
||||
static XRPAmount
|
||||
calculateBaseFee(ReadView const& view, STTx const& tx);
|
||||
|
||||
Reference in New Issue
Block a user