Merge ripple dirs with owner dirs and RPC fixes for setting quality.

This commit is contained in:
Arthur Britto
2012-08-18 12:41:58 -07:00
parent 12c34a4b75
commit d5734cd6ce
11 changed files with 107 additions and 101 deletions

View File

@@ -265,9 +265,6 @@ public:
static uint256 getRippleStateIndex(const uint160& uiA, const uint160& uiB, const uint160& uCurrency) static uint256 getRippleStateIndex(const uint160& uiA, const uint160& uiB, const uint160& uCurrency)
{ return getRippleStateIndex(NewcoinAddress::createAccountID(uiA), NewcoinAddress::createAccountID(uiB), uCurrency); } { return getRippleStateIndex(NewcoinAddress::createAccountID(uiA), NewcoinAddress::createAccountID(uiB), uCurrency); }
// Directory of lines indexed by an account (not all lines are indexed)
static uint256 getRippleDirIndex(const uint160& uAccountID);
RippleState::pointer accessRippleState(const uint256& uNode); RippleState::pointer accessRippleState(const uint256& uNode);
SLE::pointer getRippleState(LedgerStateParms& parms, const uint256& uNode); SLE::pointer getRippleState(LedgerStateParms& parms, const uint256& uNode);

View File

@@ -23,7 +23,6 @@ enum LedgerNameSpace
spaceGenerator = 'g', spaceGenerator = 'g',
spaceNickname = 'n', spaceNickname = 'n',
spaceRipple = 'r', spaceRipple = 'r',
spaceRippleDir = 'R',
spaceOffer = 'o', // Entry for an offer. spaceOffer = 'o', // Entry for an offer.
spaceOwnerDir = 'O', // Directory of things owned by an account. spaceOwnerDir = 'O', // Directory of things owned by an account.
spaceBookDir = 'B', // Directory of order books. spaceBookDir = 'B', // Directory of order books.
@@ -38,10 +37,6 @@ enum LedgerSpecificFlags
// ltOFFER // ltOFFER
lsfPassive = 0x00010000, lsfPassive = 0x00010000,
// ltRIPPLE_STATE
lsfLowIndexed = 0x00010000,
lsfHighIndexed = 0x00020000,
}; };
struct LedgerEntryFormat struct LedgerEntryFormat

View File

@@ -126,16 +126,6 @@ uint256 Ledger::getOwnerDirIndex(const uint160& uAccountID)
return s.getSHA512Half(); return s.getSHA512Half();
} }
uint256 Ledger::getRippleDirIndex(const uint160& uAccountID)
{
Serializer s(22);
s.add16(spaceRippleDir); // 2
s.add160(uAccountID); // 20
return s.getSHA512Half();
}
uint256 Ledger::getRippleStateIndex(const NewcoinAddress& naA, const NewcoinAddress& naB, const uint160& uCurrency) uint256 Ledger::getRippleStateIndex(const NewcoinAddress& naA, const NewcoinAddress& naB, const uint160& uCurrency)
{ {
uint160 uAID = naA.getAccountID(); uint160 uAID = naA.getAccountID();

View File

@@ -254,7 +254,7 @@ Json::Value NetworkOPs::getOwnerInfo(const uint256& uLedger, const NewcoinAddres
Json::Value NetworkOPs::getOwnerInfo(Ledger::pointer lpLedger, const NewcoinAddress& naAccount) Json::Value NetworkOPs::getOwnerInfo(Ledger::pointer lpLedger, const NewcoinAddress& naAccount)
{ {
Json::Value jvObjects(Json::arrayValue); Json::Value jvObjects(Json::objectValue);
uint256 uRootIndex = lpLedger->getOwnerDirIndex(naAccount.getAccountID()); uint256 uRootIndex = lpLedger->getOwnerDirIndex(naAccount.getAccountID());
@@ -272,10 +272,32 @@ Json::Value NetworkOPs::getOwnerInfo(Ledger::pointer lpLedger, const NewcoinAddr
BOOST_FOREACH(const uint256& uDirEntry, vuiIndexes) BOOST_FOREACH(const uint256& uDirEntry, vuiIndexes)
{ {
LedgerStateParms lspOffer = lepNONE; SLE::pointer sleCur = lpLedger->getSLE(uDirEntry);
SLE::pointer sleOffer = lpLedger->getOffer(lspOffer, uDirEntry);
jvObjects.append(sleOffer->getJson(0)); switch (sleCur->getType())
{
case ltOFFER:
if (!jvObjects.isMember("offers"))
jvObjects["offers"] = Json::Value(Json::arrayValue);
jvObjects["offers"].append(sleCur->getJson(0));
break;
case ltRIPPLE_STATE:
if (!jvObjects.isMember("ripple_lines"))
jvObjects["ripple_lines"] = Json::Value(Json::arrayValue);
jvObjects["ripple_lines"].append(sleCur->getJson(0));
break;
case ltACCOUNT_ROOT:
case ltDIR_NODE:
case ltGENERATOR_MAP:
case ltNICKNAME:
default:
assert(false);
break;
}
} }
uNodeDir = sleNode->getIFieldU64(sfIndexNext); uNodeDir = sleNode->getIFieldU64(sfIndexNext);

View File

@@ -1151,22 +1151,12 @@ Json::Value RPCServer::doOwnerInfo(const Json::Value& params)
uint256 uAccepted = mNetOps->getClosedLedger(); uint256 uAccepted = mNetOps->getClosedLedger();
Json::Value jAccepted = accountFromString(uAccepted, naAccount, bIndex, strIdent, iIndex); Json::Value jAccepted = accountFromString(uAccepted, naAccount, bIndex, strIdent, iIndex);
if (jAccepted.empty()) ret["accepted"] = jAccepted.empty() ? mNetOps->getOwnerInfo(uAccepted, naAccount) : jAccepted;
{
jAccepted["offers"] = mNetOps->getOwnerInfo(uAccepted, naAccount);
}
ret["accepted"] = jAccepted;
uint256 uCurrent = mNetOps->getCurrentLedger(); uint256 uCurrent = mNetOps->getCurrentLedger();
Json::Value jCurrent = accountFromString(uCurrent, naAccount, bIndex, strIdent, iIndex); Json::Value jCurrent = accountFromString(uCurrent, naAccount, bIndex, strIdent, iIndex);
if (jCurrent.empty()) ret["current"] = jCurrent.empty() ? mNetOps->getOwnerInfo(uCurrent, naAccount) : jCurrent;
{
jCurrent["offers"] = mNetOps->getOwnerInfo(uCurrent, naAccount);
}
ret["current"] = jCurrent;
return ret; return ret;
} }
@@ -1677,6 +1667,8 @@ Json::Value RPCServer::doRippleLinesGet(const Json::Value &params)
jPeer["currency"] = saBalance.getHumanCurrency(); jPeer["currency"] = saBalance.getHumanCurrency();
jPeer["limit"] = saLimit.getText(); jPeer["limit"] = saLimit.getText();
jPeer["limit_peer"] = saLimitPeer.getText(); jPeer["limit_peer"] = saLimitPeer.getText();
jPeer["quality_in"] = static_cast<Json::UInt>(line->getQualityIn());
jPeer["quality_out"] = static_cast<Json::UInt>(line->getQualityOut());
jsonLines.append(jPeer); jsonLines.append(jPeer);
} }

View File

@@ -15,18 +15,22 @@ RippleLines::RippleLines(const uint160& accountID )
void RippleLines::fillLines(const uint160& accountID, Ledger::pointer ledger) void RippleLines::fillLines(const uint160& accountID, Ledger::pointer ledger)
{ {
uint256 rootIndex = Ledger::getRippleDirIndex(accountID); uint256 rootIndex = Ledger::getOwnerDirIndex(accountID);
uint256 currentIndex = rootIndex; uint256 currentIndex = rootIndex;
LedgerStateParms lspNode = lepNONE; LedgerStateParms lspNode = lepNONE;
while (1) while (1)
{ {
SerializedLedgerEntry::pointer rippleDir=ledger->getDirNode(lspNode,currentIndex); SLE::pointer rippleDir=ledger->getDirNode(lspNode, currentIndex);
if (!rippleDir) return; if (!rippleDir) return;
STVector256 svRippleNodes = rippleDir->getIFieldV256(sfIndexes); STVector256 svOwnerNodes = rippleDir->getIFieldV256(sfIndexes);
BOOST_FOREACH(uint256& uNode, svRippleNodes.peekValue()) BOOST_FOREACH(uint256& uNode, svOwnerNodes.peekValue())
{
SLE::pointer sleCur = ledger->getSLE(uNode);
if (ltRIPPLE_STATE == sleCur->getType())
{ {
RippleState::pointer rsLine = ledger->accessRippleState(uNode); RippleState::pointer rsLine = ledger->accessRippleState(uNode);
if (rsLine) if (rsLine)
@@ -39,6 +43,7 @@ void RippleLines::fillLines(const uint160& accountID, Ledger::pointer ledger)
Log(lsWARNING) << "doRippleLinesGet: Bad index: " << uNode.ToString(); Log(lsWARNING) << "doRippleLinesGet: Bad index: " << uNode.ToString();
} }
} }
}
uint64 uNodeNext = rippleDir->getIFieldU64(sfIndexNext); uint64 uNodeNext = rippleDir->getIFieldU64(sfIndexNext);
if (!uNodeNext) return; if (!uNodeNext) return;
@@ -46,3 +51,4 @@ void RippleLines::fillLines(const uint160& accountID, Ledger::pointer ledger)
currentIndex = Ledger::getDirNodeIndex(rootIndex, uNodeNext); currentIndex = Ledger::getDirNodeIndex(rootIndex, uNodeNext);
} }
} }
// vim:ts=4

View File

@@ -13,6 +13,12 @@ RippleState::RippleState(SerializedLedgerEntry::pointer ledgerEntry) :
mLowLimit = mLedgerEntry->getIValueFieldAmount(sfLowLimit); mLowLimit = mLedgerEntry->getIValueFieldAmount(sfLowLimit);
mHighLimit = mLedgerEntry->getIValueFieldAmount(sfHighLimit); mHighLimit = mLedgerEntry->getIValueFieldAmount(sfHighLimit);
mLowQualityIn = mLedgerEntry->getIFieldU32(sfLowQualityIn);
mLowQualityOut = mLedgerEntry->getIFieldU32(sfLowQualityOut);
mHighQualityIn = mLedgerEntry->getIFieldU32(sfHighQualityIn);
mHighQualityOut = mLedgerEntry->getIFieldU32(sfHighQualityOut);
mBalance = mLedgerEntry->getIValueFieldAmount(sfBalance); mBalance = mLedgerEntry->getIValueFieldAmount(sfBalance);
mValid = true; mValid = true;

View File

@@ -24,6 +24,11 @@ private:
STAmount mLowLimit; STAmount mLowLimit;
STAmount mHighLimit; STAmount mHighLimit;
uint64 mLowQualityIn;
uint64 mLowQualityOut;
uint64 mHighQualityIn;
uint64 mHighQualityOut;
STAmount mBalance; STAmount mBalance;
bool mValid; bool mValid;
@@ -42,6 +47,9 @@ public:
STAmount getLimit() const { return mViewLowest ? mLowLimit : mHighLimit; } STAmount getLimit() const { return mViewLowest ? mLowLimit : mHighLimit; }
STAmount getLimitPeer() const { return mViewLowest ? mHighLimit : mLowLimit; } STAmount getLimitPeer() const { return mViewLowest ? mHighLimit : mLowLimit; }
uint32 getQualityIn() const { return mViewLowest ? mLowQualityIn : mHighQualityIn; }
uint32 getQualityOut() const { return mViewLowest ? mLowQualityOut : mHighQualityOut; }
SerializedLedgerEntry::pointer getSLE() { return mLedgerEntry; } SerializedLedgerEntry::pointer getSLE() { return mLedgerEntry; }
const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; } const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; } SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }

View File

@@ -270,10 +270,10 @@ Transaction::pointer Transaction::setCreditSet(
mTransaction->setITFieldAmount(sfLimitAmount, saLimitAmount); mTransaction->setITFieldAmount(sfLimitAmount, saLimitAmount);
if (bQualityIn) if (bQualityIn)
mTransaction->setITFieldU32(sfAcceptRate, uQualityIn); mTransaction->setITFieldU32(sfQualityIn, uQualityIn);
if (bQualityOut) if (bQualityOut)
mTransaction->setITFieldU32(sfAcceptRate, uQualityOut); mTransaction->setITFieldU32(sfQualityOut, uQualityOut);
sign(naPrivateKey); sign(naPrivateKey);

View File

@@ -145,7 +145,7 @@ STAmount TransactionEngine::rippleLimit(const uint160& uToAccountID, const uint1
} }
uint32 TransactionEngine::rippleTransfer(const uint160& uIssuerID) uint32 TransactionEngine::rippleTransferRate(const uint160& uIssuerID)
{ {
SLE::pointer sleAccount = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uIssuerID)); SLE::pointer sleAccount = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uIssuerID));
@@ -298,13 +298,13 @@ STAmount TransactionEngine::accountFunds(const uint160& uAccountID, const STAmou
} }
// Calculate transit fee. // Calculate transit fee.
STAmount TransactionEngine::rippleTransfer(const uint160& uSenderID, const uint160& uReceiverID, const uint160& uIssuerID, const STAmount& saAmount) STAmount TransactionEngine::rippleTransferFee(const uint160& uSenderID, const uint160& uReceiverID, const uint160& uIssuerID, const STAmount& saAmount)
{ {
STAmount saTransitFee; STAmount saTransitFee;
if (uSenderID != uIssuerID && uReceiverID != uIssuerID) if (uSenderID != uIssuerID && uReceiverID != uIssuerID)
{ {
uint32 uTransitRate = rippleTransfer(uIssuerID); uint32 uTransitRate = rippleTransferRate(uIssuerID);
if (QUALITY_ONE != uTransitRate) if (QUALITY_ONE != uTransitRate)
{ {
@@ -380,7 +380,7 @@ STAmount TransactionEngine::rippleSend(const uint160& uSenderID, const uint160&
{ {
// Sending 3rd party IOUs: transit. // Sending 3rd party IOUs: transit.
STAmount saTransitFee = rippleTransfer(uSenderID, uReceiverID, uIssuerID, saAmount); STAmount saTransitFee = rippleTransferFee(uSenderID, uReceiverID, uIssuerID, saAmount);
saActual = saTransitFee.isZero() ? saAmount : saAmount+saTransitFee; saActual = saTransitFee.isZero() ? saAmount : saAmount+saTransitFee;
@@ -1505,7 +1505,6 @@ TransactionEngineResult TransactionEngine::doCreditSet(const SerializedTransacti
} }
bool bFlipped = mTxnAccountID > uDstAccountID; bool bFlipped = mTxnAccountID > uDstAccountID;
uint32 uFlags = bFlipped ? lsfLowIndexed : lsfHighIndexed;
bool bLimitAmount = txn.getITFieldPresent(sfLimitAmount); bool bLimitAmount = txn.getITFieldPresent(sfLimitAmount);
STAmount saLimitAmount = bLimitAmount ? txn.getITFieldAmount(sfLimitAmount) : STAmount(); STAmount saLimitAmount = bLimitAmount ? txn.getITFieldAmount(sfLimitAmount) : STAmount();
bool bQualityIn = txn.getITFieldPresent(sfQualityIn); bool bQualityIn = txn.getITFieldPresent(sfQualityIn);
@@ -1514,7 +1513,6 @@ TransactionEngineResult TransactionEngine::doCreditSet(const SerializedTransacti
uint32 uQualityOut = bQualityIn ? txn.getITFieldU32(sfQualityOut) : 0; uint32 uQualityOut = bQualityIn ? txn.getITFieldU32(sfQualityOut) : 0;
uint160 uCurrencyID = saLimitAmount.getCurrency(); uint160 uCurrencyID = saLimitAmount.getCurrency();
STAmount saBalance(uCurrencyID); STAmount saBalance(uCurrencyID);
bool bAddIndex = false;
bool bDelIndex = false; bool bDelIndex = false;
SLE::pointer sleRippleState = entryCache(ltRIPPLE_STATE, Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID)); SLE::pointer sleRippleState = entryCache(ltRIPPLE_STATE, Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID));
@@ -1540,7 +1538,7 @@ TransactionEngineResult TransactionEngine::doCreditSet(const SerializedTransacti
// Zero balance and eliminating last limit. // Zero balance and eliminating last limit.
bDelIndex = true; bDelIndex = true;
terResult = dirDelete(false, uSrcRef, Ledger::getRippleDirIndex(mTxnAccountID), sleRippleState->getIndex()); terResult = dirDelete(false, uSrcRef, Ledger::getOwnerDirIndex(mTxnAccountID), sleRippleState->getIndex());
} }
} }
#endif #endif
@@ -1576,15 +1574,10 @@ TransactionEngineResult TransactionEngine::doCreditSet(const SerializedTransacti
sleRippleState->makeIFieldAbsent(bFlipped ? sfLowQualityOut : sfHighQualityOut); sleRippleState->makeIFieldAbsent(bFlipped ? sfLowQualityOut : sfHighQualityOut);
} }
bAddIndex = !(sleRippleState->getFlags() & uFlags);
if (bAddIndex)
sleRippleState->setFlag(uFlags);
entryModify(sleRippleState); entryModify(sleRippleState);
} }
Log(lsINFO) << "doCreditSet: Modifying ripple line: bAddIndex=" << bAddIndex << " bDelIndex=" << bDelIndex; Log(lsINFO) << "doCreditSet: Modifying ripple line: bDelIndex=" << bDelIndex;
} }
// Line does not exist. // Line does not exist.
else if (saLimitAmount.isZero()) else if (saLimitAmount.isZero())
@@ -1598,12 +1591,10 @@ TransactionEngineResult TransactionEngine::doCreditSet(const SerializedTransacti
// Create a new ripple line. // Create a new ripple line.
STAmount saZero(uCurrencyID); STAmount saZero(uCurrencyID);
bAddIndex = true;
sleRippleState = entryCreate(ltRIPPLE_STATE, Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID)); sleRippleState = entryCreate(ltRIPPLE_STATE, Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID));
Log(lsINFO) << "doCreditSet: Creating ripple line: " << sleRippleState->getIndex().ToString(); Log(lsINFO) << "doCreditSet: Creating ripple line: " << sleRippleState->getIndex().ToString();
sleRippleState->setFlag(uFlags);
sleRippleState->setIFieldAmount(sfBalance, saZero); // Zero balance in currency. sleRippleState->setIFieldAmount(sfBalance, saZero); // Zero balance in currency.
sleRippleState->setIFieldAmount(bFlipped ? sfHighLimit : sfLowLimit, saLimitAmount); sleRippleState->setIFieldAmount(bFlipped ? sfHighLimit : sfLowLimit, saLimitAmount);
sleRippleState->setIFieldAmount(bFlipped ? sfLowLimit : sfHighLimit, saZero); sleRippleState->setIFieldAmount(bFlipped ? sfLowLimit : sfHighLimit, saZero);
@@ -1613,14 +1604,13 @@ TransactionEngineResult TransactionEngine::doCreditSet(const SerializedTransacti
sleRippleState->setIFieldU32(bFlipped ? sfLowQualityIn : sfHighQualityIn, uQualityIn); sleRippleState->setIFieldU32(bFlipped ? sfLowQualityIn : sfHighQualityIn, uQualityIn);
if (uQualityOut) if (uQualityOut)
sleRippleState->setIFieldU32(bFlipped ? sfLowQualityOut : sfHighQualityOut, uQualityOut); sleRippleState->setIFieldU32(bFlipped ? sfLowQualityOut : sfHighQualityOut, uQualityOut);
}
if (bAddIndex) uint64 uSrcRef; // Ignored, dirs never delete.
{
uint64 uSrcRef; // Ignored, ripple_state dirs never delete.
// XXX Make dirAdd more flexiable to take vector. terResult = dirAdd(uSrcRef, Ledger::getOwnerDirIndex(mTxnAccountID), sleRippleState->getIndex());
terResult = dirAdd(uSrcRef, Ledger::getRippleDirIndex(mTxnAccountID), sleRippleState->getIndex());
if (terSUCCESS == terResult)
terResult = dirAdd(uSrcRef, Ledger::getOwnerDirIndex(uDstAccountID), sleRippleState->getIndex());
} }
Log(lsINFO) << "doCreditSet<"; Log(lsINFO) << "doCreditSet<";
@@ -1927,16 +1917,16 @@ bool TransactionEngine::calcNodeOfferRev(
uint160& uNxtIssuerID = nxtPN.uIssuerID; uint160& uNxtIssuerID = nxtPN.uIssuerID;
uint160& uNxtAccountID = nxtPN.uAccountID; uint160& uNxtAccountID = nxtPN.uAccountID;
STAmount saTransferRate = STAmount(CURRENCY_ONE, rippleTransfer(uCurIssuerID), -9); STAmount saTransferRate = STAmount(CURRENCY_ONE, rippleTransferRate(uCurIssuerID), -9);
uint256 uDirectTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, uCurCurrencyID, uCurIssuerID); uint256 uDirectTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, uCurCurrencyID, uCurIssuerID);
uint256 uDirectEnd = Ledger::getQualityNext(uDirectTip); uint256 uDirectEnd = Ledger::getQualityNext(uDirectTip);
bool bAdvance = !entryCache(ltDIR_NODE, uDirectTip); bool bAdvance = !entryCache(ltDIR_NODE, uDirectTip);
STAmount& saPrvDlvReq = prvPN.saRevDeliver; STAmount& saPrvDlvReq = prvPN.saRevDeliver; // To be adjusted.
STAmount saPrvDlvAct; STAmount saPrvDlvAct;
STAmount& saCurDlvReq = curPN.saRevDeliver; // Reverse driver. const STAmount& saCurDlvReq = curPN.saRevDeliver; // Reverse driver.
STAmount saCurDlvAct; STAmount saCurDlvAct;
while (!!uDirectTip // Have a quality. while (!!uDirectTip // Have a quality.
@@ -2119,7 +2109,7 @@ bool TransactionEngine::calcNodeOfferFwd(
uint160& uNxtIssuerID = nxtPN.uIssuerID; uint160& uNxtIssuerID = nxtPN.uIssuerID;
uint160& uNxtAccountID = nxtPN.uAccountID; uint160& uNxtAccountID = nxtPN.uAccountID;
STAmount saTransferRate = STAmount(CURRENCY_ONE, rippleTransfer(uCurIssuerID), -9); STAmount saTransferRate = STAmount(CURRENCY_ONE, rippleTransferRate(uCurIssuerID), -9);
uint256 uDirectTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, uCurCurrencyID, uCurIssuerID); uint256 uDirectTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, uCurCurrencyID, uCurIssuerID);
uint256 uDirectEnd = Ledger::getQualityNext(uDirectTip); uint256 uDirectEnd = Ledger::getQualityNext(uDirectTip);
@@ -2730,7 +2720,7 @@ bool TransactionEngine::calcNodeAccountRev(unsigned int uIndex, PathState::point
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
Log(lsINFO) << str(boost::format("calcNodeAccountRev: Rate : 1.0 : transfer_rate")); Log(lsINFO) << str(boost::format("calcNodeAccountRev: Rate : 1.0 : transfer_rate"));
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvRedeemReq, saCurIssueReq, saPrvRedeemAct, saCurIssueAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvRedeemReq, saCurIssueReq, saPrvRedeemAct, saCurIssueAct);
} }
// issue (part 1)-> redeem // issue (part 1)-> redeem
@@ -2789,7 +2779,7 @@ bool TransactionEngine::calcNodeAccountRev(unsigned int uIndex, PathState::point
&& saCurDeliverReq) // Need some issued. && saCurDeliverReq) // Need some issued.
{ {
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvRedeemReq, saCurDeliverReq, saPrvRedeemAct, saCurDeliverAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvRedeemReq, saCurDeliverReq, saPrvRedeemAct, saCurDeliverAct);
} }
// issue -> deliver/issue // issue -> deliver/issue
@@ -2848,7 +2838,7 @@ bool TransactionEngine::calcNodeAccountRev(unsigned int uIndex, PathState::point
&& saCurIssueReq) // Need some issued. && saCurIssueReq) // Need some issued.
{ {
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvDeliverReq, saCurIssueReq, saPrvDeliverAct, saCurIssueAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvDeliverReq, saCurIssueReq, saPrvDeliverAct, saCurIssueAct);
} }
if (!saCurDeliverAct && !saCurIssueAct) if (!saCurDeliverAct && !saCurIssueAct)
@@ -2869,7 +2859,7 @@ bool TransactionEngine::calcNodeAccountRev(unsigned int uIndex, PathState::point
&& saCurDeliverReq != saCurDeliverAct) // Can only if issue if more can not be redeemed. && saCurDeliverReq != saCurDeliverAct) // Can only if issue if more can not be redeemed.
{ {
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvDeliverReq, saCurDeliverReq, saPrvDeliverAct, saCurDeliverAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvDeliverReq, saCurDeliverReq, saPrvDeliverAct, saCurDeliverAct);
} }
if (!saCurDeliverAct) if (!saCurDeliverAct)
@@ -3041,7 +3031,7 @@ bool TransactionEngine::calcNodeAccountFwd(unsigned int uIndex, PathState::point
&& saCurIssueReq) && saCurIssueReq)
{ {
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvRedeemReq, saCurIssueReq, saPrvRedeemAct, saCurIssueAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvRedeemReq, saCurIssueReq, saPrvRedeemAct, saCurIssueAct);
} }
// Previous issue part 1: issue -> redeem // Previous issue part 1: issue -> redeem
@@ -3077,7 +3067,7 @@ bool TransactionEngine::calcNodeAccountFwd(unsigned int uIndex, PathState::point
if (saPrvRedeemReq) // Previous wants to redeem. if (saPrvRedeemReq) // Previous wants to redeem.
{ {
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvRedeemReq, saCurDeliverReq, saPrvRedeemAct, saCurDeliverAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvRedeemReq, saCurDeliverReq, saPrvRedeemAct, saCurDeliverAct);
} }
// issue -> issue // issue -> issue
@@ -3125,7 +3115,7 @@ bool TransactionEngine::calcNodeAccountFwd(unsigned int uIndex, PathState::point
&& saCurIssueReq) // Current wants issue. && saCurIssueReq) // Current wants issue.
{ {
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvRedeemReq, saCurIssueReq, saPrvRedeemAct, saCurIssueAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvRedeemReq, saCurIssueReq, saPrvRedeemAct, saCurIssueAct);
} }
// No income balance adjustments necessary. The paying side inside the offer paid and the next link will receive. // No income balance adjustments necessary. The paying side inside the offer paid and the next link will receive.
@@ -3142,7 +3132,7 @@ bool TransactionEngine::calcNodeAccountFwd(unsigned int uIndex, PathState::point
&& saCurIssueReq) // Current wants issue. && saCurIssueReq) // Current wants issue.
{ {
// Rate : 1.0 : transfer_rate // Rate : 1.0 : transfer_rate
calcNodeRipple(QUALITY_ONE, rippleTransfer(uCurAccountID), saPrvDeliverReq, saCurDeliverReq, saPrvDeliverAct, saCurDeliverAct); calcNodeRipple(QUALITY_ONE, rippleTransferRate(uCurAccountID), saPrvDeliverReq, saCurDeliverReq, saPrvDeliverAct, saCurDeliverAct);
} }
// No income balance adjustments necessary. The paying side inside the offer paid and the next link will receive. // No income balance adjustments necessary. The paying side inside the offer paid and the next link will receive.
@@ -3742,7 +3732,7 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
terResult = dirAdd( terResult = dirAdd(
uSrcRef, uSrcRef,
Ledger::getRippleDirIndex(mTxnAccountID), // The source ended up owing. Ledger::getOwnerDirIndex(mTxnAccountID), // The source ended up owing.
sleRippleState->getIndex()); // Adding current entry. sleRippleState->getIndex()); // Adding current entry.
if (terSUCCESS != terResult) if (terSUCCESS != terResult)

View File

@@ -221,14 +221,14 @@ protected:
void entryDelete(SLE::pointer sleEntry, bool unfunded = false); void entryDelete(SLE::pointer sleEntry, bool unfunded = false);
void entryModify(SLE::pointer sleEntry); void entryModify(SLE::pointer sleEntry);
uint32 rippleTransfer(const uint160& uIssuerID); uint32 rippleTransferRate(const uint160& uIssuerID);
STAmount rippleBalance(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID); STAmount rippleBalance(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID);
STAmount rippleLimit(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID); STAmount rippleLimit(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID);
uint32 rippleQualityIn(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID); uint32 rippleQualityIn(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID);
uint32 rippleQualityOut(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID); uint32 rippleQualityOut(const uint160& uToAccountID, const uint160& uFromAccountID, const uint160& uCurrencyID);
STAmount rippleHolds(const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID); STAmount rippleHolds(const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID);
STAmount rippleTransfer(const uint160& uSenderID, const uint160& uReceiverID, const uint160& uIssuerID, const STAmount& saAmount); STAmount rippleTransferFee(const uint160& uSenderID, const uint160& uReceiverID, const uint160& uIssuerID, const STAmount& saAmount);
void rippleCredit(const uint160& uSenderID, const uint160& uReceiverID, const STAmount& saAmount, bool bCheckIssuer=true); void rippleCredit(const uint160& uSenderID, const uint160& uReceiverID, const STAmount& saAmount, bool bCheckIssuer=true);
STAmount rippleSend(const uint160& uSenderID, const uint160& uReceiverID, const STAmount& saAmount); STAmount rippleSend(const uint160& uSenderID, const uint160& uReceiverID, const STAmount& saAmount);