mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +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));
|
SLE::pointer sleAccount = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uAccountID));
|
||||||
uint64 uReserve = mLedger->getReserve(sleAccount->getFieldU32(sfOwnerCount));
|
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();
|
saAmount.zero();
|
||||||
}
|
}
|
||||||
else
|
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
|
else
|
||||||
{
|
{
|
||||||
saAmount = rippleHolds(uAccountID, uCurrencyID, uIssuerID);
|
saAmount = rippleHolds(uAccountID, uCurrencyID, uIssuerID);
|
||||||
}
|
|
||||||
|
|
||||||
cLog(lsINFO) << boost::str(boost::format("accountHolds: uAccountID=%s saAmount=%s")
|
cLog(lsINFO) << boost::str(boost::format("accountHolds: uAccountID=%s saAmount=%s")
|
||||||
% RippleAddress::createHumanAccountID(uAccountID)
|
% RippleAddress::createHumanAccountID(uAccountID)
|
||||||
% saAmount.getFullText());
|
% saAmount.getFullText());
|
||||||
|
}
|
||||||
|
|
||||||
return saAmount;
|
return saAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user