fix SponsorshipTransfer too

This commit is contained in:
Mayukha Vadari
2026-06-24 16:28:44 -04:00
parent 49fc14d703
commit 3bdc96c0f3

View File

@@ -265,6 +265,32 @@ SponsorshipTransfer::preclaim(PreclaimContext const& ctx)
if (!sle)
return tecNO_ENTRY;
// v1 scope: an object is only sponsorable via SponsorshipTransfer if
// its creating transaction type is itself permitted to set
// spfSponsorReserve (the allow-list in preflight1Sponsor). Otherwise
// an Oracle / Ticket / DID / etc. could be retroactively sponsored
// even though its creating tx cannot be, leaving downstream
// transactors with no path to maintain the sponsorship invariants.
switch (sle->getType())
{
case ltDELEGATE:
case ltDEPOSIT_PREAUTH:
case ltMPTOKEN:
case ltMPTOKEN_ISSUANCE:
case ltLOAN:
case ltCREDENTIAL:
case ltRIPPLE_STATE:
// TBD object types (Check / Escrow / PaymentChannel) — kept
// sponsorable in v1; revisit when their tx-level support is
// formalized.
case ltCHECK:
case ltESCROW:
case ltPAYCHAN:
break;
default:
return tecNO_PERMISSION;
}
auto const ownerCountDelta = getLedgerEntryOwnerCount(sle);
auto const owner = getLedgerEntryOwner(ctx.view, sle, sponseeID);