mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 06:55:50 +00:00
Fix calculation of XRP available after reserve.
This commit is contained in:
@@ -1072,25 +1072,31 @@ STAmount LedgerEntrySet::accountHolds(const uint160& uAccountID, const uint160&
|
||||
SLE::pointer sleAccount = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uAccountID));
|
||||
uint64 uReserve = mLedger->getReserve(sleAccount->getFieldU32(sfOwnerCount));
|
||||
|
||||
saAmount = sleAccount->getFieldAmount(sfBalance)-uReserve;
|
||||
STAmount saBalance = sleAccount->getFieldAmount(sfBalance);
|
||||
|
||||
if (saAmount < uReserve)
|
||||
if (saBalance < uReserve)
|
||||
{
|
||||
saAmount.zero();
|
||||
}
|
||||
else
|
||||
{
|
||||
saAmount -= uReserve;
|
||||
saAmount = saBalance-uReserve;
|
||||
}
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("accountHolds: uAccountID=%s saAmount=%s saBalance=%s uReserve=%d")
|
||||
% RippleAddress::createHumanAccountID(uAccountID)
|
||||
% saAmount.getFullText()
|
||||
% saBalance.getFullText()
|
||||
% uReserve);
|
||||
}
|
||||
else
|
||||
{
|
||||
saAmount = rippleHolds(uAccountID, uCurrencyID, uIssuerID);
|
||||
}
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("accountHolds: uAccountID=%s saAmount=%s")
|
||||
% RippleAddress::createHumanAccountID(uAccountID)
|
||||
% saAmount.getFullText());
|
||||
}
|
||||
|
||||
return saAmount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user