fix fees().accountReserve(0) to fees().reserve

This commit is contained in:
tequ
2025-08-01 01:59:08 +09:00
parent 0bddc95444
commit 6e01f233e4
8 changed files with 16 additions and 19 deletions

View File

@@ -142,7 +142,7 @@ FeeVoteImpl::doValidation(
};
vote(lastFees.base, target_.reference_fee, "base fee", sfBaseFeeDrops);
vote(
lastFees.accountReserve(0),
lastFees.reserve,
target_.account_reserve,
"base reserve",
sfReserveBaseDrops);
@@ -178,7 +178,7 @@ FeeVoteImpl::doValidation(
vote(lastFees.base, target_.reference_fee, to64, "base fee", sfBaseFee);
vote(
lastFees.accountReserve(0),
lastFees.reserve,
target_.account_reserve,
to32,
"base reserve",
@@ -207,7 +207,7 @@ FeeVoteImpl::doVoting(
lastClosedLedger->fees().base, target_.reference_fee);
detail::VotableValue baseReserveVote(
lastClosedLedger->fees().accountReserve(0), target_.account_reserve);
lastClosedLedger->fees().reserve, target_.account_reserve);
detail::VotableValue incReserveVote(
lastClosedLedger->fees().increment, target_.owner_reserve);

View File

@@ -2925,8 +2925,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters)
if (!human)
{
l[jss::base_fee] = baseFee.jsonClipped();
l[jss::reserve_base] =
lpClosed->fees().accountReserve(0).jsonClipped();
l[jss::reserve_base] = lpClosed->fees().reserve.jsonClipped();
l[jss::reserve_inc] = lpClosed->fees().increment.jsonClipped();
l[jss::close_time] = Json::Value::UInt(
lpClosed->info().closeTime.time_since_epoch().count());
@@ -2934,8 +2933,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters)
else
{
l[jss::base_fee_xrp] = baseFee.decimalXRP();
l[jss::reserve_base_xrp] =
lpClosed->fees().accountReserve(0).decimalXRP();
l[jss::reserve_base_xrp] = lpClosed->fees().reserve.decimalXRP();
l[jss::reserve_inc_xrp] = lpClosed->fees().increment.decimalXRP();
if (auto const closeOffset = app_.timeKeeper().closeOffset();
@@ -3125,8 +3123,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr<ReadView const> const& lpAccepted)
if (!lpAccepted->rules().enabled(featureXRPFees))
jvObj[jss::fee_ref] = Config::FEE_UNITS_DEPRECATED;
jvObj[jss::fee_base] = lpAccepted->fees().base.jsonClipped();
jvObj[jss::reserve_base] =
lpAccepted->fees().accountReserve(0).jsonClipped();
jvObj[jss::reserve_base] = lpAccepted->fees().reserve.jsonClipped();
jvObj[jss::reserve_inc] =
lpAccepted->fees().increment.jsonClipped();
@@ -4177,8 +4174,7 @@ NetworkOPsImp::subLedger(InfoSub::ref isrListener, Json::Value& jvResult)
if (!lpClosed->rules().enabled(featureXRPFees))
jvResult[jss::fee_ref] = Config::FEE_UNITS_DEPRECATED;
jvResult[jss::fee_base] = lpClosed->fees().base.jsonClipped();
jvResult[jss::reserve_base] =
lpClosed->fees().accountReserve(0).jsonClipped();
jvResult[jss::reserve_base] = lpClosed->fees().reserve.jsonClipped();
jvResult[jss::reserve_inc] = lpClosed->fees().increment.jsonClipped();
jvResult[jss::network_id] = app_.config().NETWORK_ID;
}

View File

@@ -1113,7 +1113,7 @@ TxQ::apply(
comparable scale to the base fee, ignore the
reserve. Only check the account balance.
*/
auto const reserve = view.fees().accountReserve(0);
auto const reserve = view.fees().reserve;
auto const base = view.fees().base;
if (totalFee >= balance ||
(reserve > 10 * base && totalFee >= reserve))

View File

@@ -206,8 +206,7 @@ PathRequest::isValid(std::shared_ptr<RippleLineCache> const& crCache)
return false;
}
if (!convert_all_ &&
saDstAmount < STAmount(lrLedger->fees().accountReserve(0)))
if (!convert_all_ && saDstAmount < STAmount(lrLedger->fees().reserve))
{
// Payment must meet reserve.
jvStatus = rpcError(rpcDST_AMT_MALFORMED);

View File

@@ -278,7 +278,7 @@ Pathfinder::findPaths(
return false;
}
auto const reserve = STAmount(mLedger->fees().accountReserve(0));
auto const reserve = STAmount(mLedger->fees().reserve);
if (mDstAmount < reserve)
{
JLOG(j_.debug())

View File

@@ -316,7 +316,7 @@ Payment::preclaim(PreclaimContext const& ctx)
// transaction would succeed.
return telNO_DST_PARTIAL;
}
else if (dstAmount < STAmount(ctx.view.fees().accountReserve(0)))
else if (dstAmount < STAmount(ctx.view.fees().reserve))
{
// accountReserve is the minimum amount that an account can have.
// Reserve is not scaled by load.
@@ -608,6 +608,7 @@ Payment::doApply()
auto const ownerCount = sleSrc->getFieldU32(sfOwnerCount);
// This is the total reserve in drops.
// TODO: TEQU
auto const reserve = view().fees().accountReserve(ownerCount);
// mPriorBalance is the balance on the sending account BEFORE the
@@ -659,7 +660,7 @@ Payment::doApply()
// to get the account un-wedged.
// Get the base reserve.
XRPAmount const dstReserve{view().fees().accountReserve(0)};
XRPAmount const dstReserve{view().fees().reserve};
if (dstAmount > dstReserve ||
sleDst->getFieldAmount(sfBalance) > dstReserve)

View File

@@ -446,6 +446,7 @@ transferHelper(
{
auto const ownerCount = sleSrc->getFieldU32(sfOwnerCount);
// TODO: TEQU
auto const reserve = psb.fees().accountReserve(ownerCount);
auto const availableBalance = [&]() -> STAmount {
@@ -474,7 +475,7 @@ transferHelper(
// Already checked, but OK to check again
return tecNO_DST;
}
if (amt < psb.fees().accountReserve(0))
if (amt < psb.fees().reserve)
{
JLOG(j.trace()) << "Insufficient payment to create account.";
return tecNO_DST_INSUF_XRP;

View File

@@ -630,7 +630,7 @@ xrpLiquid(
// AMMs have no reserve requirement
auto const reserve = sle->isFieldPresent(sfAMMID)
? XRPAmount{0}
? XRPAmount{0} // TODO: TEQU
: view.fees().accountReserve(ownerCount);
auto const fullBalance = sle->getFieldAmount(sfBalance);