address reviews

This commit is contained in:
tequ
2026-01-15 14:51:05 +09:00
parent 9e65dba253
commit c321e1070d
4 changed files with 15 additions and 9 deletions

View File

@@ -34,10 +34,14 @@ struct Fees
bool isAccountSponsored = false,
std::size_t sponsoringAccountCount = 0) const
{
return (isAccountSponsored ? XRPAmount(0) : reserve) +
increment *
(ownerCount + sponsoringOwnerCount - sponsoredOwnerCount) +
reserve * sponsoringAccountCount;
auto const accountReserveUnits =
(isAccountSponsored ? 0 : 1) + sponsoringAccountCount;
auto const ownerReserveUnits =
(ownerCount - sponsoredOwnerCount) + sponsoringOwnerCount;
return (reserve * accountReserveUnits) +
(increment * ownerReserveUnits);
}
};

View File

@@ -109,7 +109,7 @@ transResults()
MAKE_ERROR(tecPSEUDO_ACCOUNT, "This operation is not allowed against a pseudo-account."),
MAKE_ERROR(tecPRECISION_LOSS, "The amounts used by the transaction cannot interact."),
MAKE_ERROR(tecNO_DELEGATE_PERMISSION, "Delegated account lacks permission to perform this transaction."),
MAKE_ERROR(tecNO_SPONSOR_PERMISSION, "Does not have permission to sponsored this transaction."),
MAKE_ERROR(tecNO_SPONSOR_PERMISSION, "Sponsor has not authorized this transaction."),
MAKE_ERROR(tefALREADY, "The exact transaction was already in this ledger."),
MAKE_ERROR(tefBAD_ADD_AUTH, "Not authorized to add account."),

View File

@@ -337,6 +337,9 @@ Payment::preclaim(PreclaimContext const& ctx)
}
else
{
// The tfSponsorCreatedAccount flag is specific to account creation via
// sponsorship. If the destination account already exists, applying this
// flag is invalid.
if (txFlags & tfSponsorCreatedAccount)
return tecNO_SPONSOR_PERMISSION;
@@ -425,12 +428,11 @@ Payment::doApply()
{
auto const sponsor = view().peek(keylet::account(account_));
if (!sponsor)
return tecINTERNAL; // LCOV_EXCL_LINE
return tefINTERNAL; // LCOV_EXCL_LINE
auto const currentSponsoringAccountCount =
sponsor->getFieldU32(sfSponsoringAccountCount);
sponsor->setFieldU32(
sfSponsoringAccountCount, currentSponsoringAccountCount + 1);
view().update(sponsor);
addSponsorToLedgerEntry(sleDst, sponsor);
view().update(sponsor);

View File

@@ -805,8 +805,8 @@ Transactor::checkSign(
auto const sponsorAcc = sponsorObj.getAccountID(sfAccount);
auto const sponsorSignature =
sigObject.getFieldObject(sfSponsorSignature);
if (auto const ret =
checkSign(view, flags, {}, sponsorAcc, sponsorSignature, j);
if (auto const ret = checkSign(
view, flags, std::nullopt, sponsorAcc, sponsorSignature, j);
!isTesSuccess(ret))
return ret;
}