mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
fix: XChainAddAccountCreateAttestation redirects relayer sponsorship to door-owned claim objects
This commit is contained in:
@@ -1030,7 +1030,8 @@ applyCreateAccountAttestations(
|
||||
|
||||
// Check reserve
|
||||
auto const balance = (*sleDoor)[sfBalance];
|
||||
// Door account should not have a sponsor
|
||||
// Don't sponsor door account objects in transactions not sent by the door account
|
||||
// itself
|
||||
if (auto const ret = checkInsufficientReserve(psb, tx, sleDoor, balance, {}, 1, 0, j);
|
||||
!isTesSuccess(ret))
|
||||
return Unexpected(ret); // tecINSUFFICIENT_RESERVE
|
||||
@@ -1138,10 +1139,9 @@ applyCreateAccountAttestations(
|
||||
if (!sleDoor)
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
// Reserve was already checked
|
||||
auto const sponsor = getTxReserveSponsor(psb, tx);
|
||||
adjustOwnerCount(psb, sleDoor, sponsor, 1, j);
|
||||
addSponsorToLedgerEntry(createdSleClaimID, sponsor);
|
||||
// Don't sponsor door account objects in transactions not sent by the door account
|
||||
// itself
|
||||
adjustOwnerCount(psb, sleDoor, {}, 1, j);
|
||||
psb.insert(createdSleClaimID);
|
||||
psb.update(sleDoor);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@@ -5121,6 +5122,28 @@ public:
|
||||
BEAST_EXPECT(sponsoredOwnerCount(env, alice) == 0);
|
||||
BEAST_EXPECT(sponsoringOwnerCount(env, sponsor) == 1);
|
||||
}
|
||||
// XChainCreateAccountClaimID
|
||||
{
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 0);
|
||||
BEAST_EXPECT(sponsoredOwnerCount(env, alice) == 0);
|
||||
BEAST_EXPECT(ownerCount(env, doorA) == 2);
|
||||
BEAST_EXPECT(sponsoredOwnerCount(env, doorA) == 1);
|
||||
BEAST_EXPECT(sponsoringOwnerCount(env, sponsor) == 1);
|
||||
|
||||
env(create_account_attestation(
|
||||
alice, jvb, alice, XRP(20), XRP(0), bob, false, 2, bob, signer),
|
||||
sponsor::as(sponsor, spfSponsorReserve),
|
||||
sig(sfSponsorSignature, sponsor),
|
||||
ter(tesSUCCESS));
|
||||
env.close();
|
||||
|
||||
// XChainCreateAccountClaimID not sponsored
|
||||
BEAST_EXPECT(ownerCount(env, alice) == 0);
|
||||
BEAST_EXPECT(sponsoredOwnerCount(env, alice) == 0);
|
||||
BEAST_EXPECT(ownerCount(env, doorA) == 3);
|
||||
BEAST_EXPECT(sponsoredOwnerCount(env, doorA) == 1);
|
||||
BEAST_EXPECT(sponsoringOwnerCount(env, sponsor) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -533,19 +533,19 @@ public:
|
||||
/** Return the number of sponsored objects owned by an account.
|
||||
* Returns 0 if the account does not exist.
|
||||
*/
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
sponsoredOwnerCount(Account const& account) const;
|
||||
|
||||
/** Return the number of sponsoring objects owned by an account.
|
||||
* Returns 0 if the account does not exist.
|
||||
*/
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
sponsoringOwnerCount(Account const& account) const;
|
||||
|
||||
/** Return the number of sponsoring accounts owned by an account.
|
||||
* Returns 0 if the account does not exist.
|
||||
*/
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
sponsoringAccountCount(Account const& account) const;
|
||||
|
||||
/** Return an account root.
|
||||
|
||||
Reference in New Issue
Block a user