mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-05 16:57:56 +00:00
Some quick changes to improve pathfinding performance. (20% faster roughly)
This commit is contained in:
@@ -1025,7 +1025,7 @@ uint32 LedgerEntrySet::rippleQualityIn(const uint160& uToAccountID, const uint16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cLog(lsINFO) << boost::str(boost::format("rippleQuality: %s uToAccountID=%s uFromAccountID=%s uCurrencyID=%s bLine=%d uQuality=%f")
|
cLog(lsTRACE) << boost::str(boost::format("rippleQuality: %s uToAccountID=%s uFromAccountID=%s uCurrencyID=%s bLine=%d uQuality=%f")
|
||||||
% (sfLow == sfLowQualityIn ? "in" : "out")
|
% (sfLow == sfLowQualityIn ? "in" : "out")
|
||||||
% RippleAddress::createHumanAccountID(uToAccountID)
|
% RippleAddress::createHumanAccountID(uToAccountID)
|
||||||
% RippleAddress::createHumanAccountID(uFromAccountID)
|
% RippleAddress::createHumanAccountID(uFromAccountID)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ TER PathState::pushImply(
|
|||||||
const PaymentNode& pnPrv = vpnNodes.back();
|
const PaymentNode& pnPrv = vpnNodes.back();
|
||||||
TER terResult = tesSUCCESS;
|
TER terResult = tesSUCCESS;
|
||||||
|
|
||||||
cLog(lsINFO) << "pushImply> "
|
cLog(lsTRACE) << "pushImply> "
|
||||||
<< RippleAddress::createHumanAccountID(uAccountID)
|
<< RippleAddress::createHumanAccountID(uAccountID)
|
||||||
<< " " << STAmount::createHumanCurrency(uCurrencyID)
|
<< " " << STAmount::createHumanCurrency(uCurrencyID)
|
||||||
<< " " << RippleAddress::createHumanAccountID(uIssuerID);
|
<< " " << RippleAddress::createHumanAccountID(uIssuerID);
|
||||||
@@ -107,7 +107,7 @@ TER PathState::pushImply(
|
|||||||
uIssuerID);
|
uIssuerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
cLog(lsINFO) << boost::str(boost::format("pushImply< : %s") % transToken(terResult));
|
cLog(lsTRACE) << boost::str(boost::format("pushImply< : %s") % transToken(terResult));
|
||||||
|
|
||||||
return terResult;
|
return terResult;
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ TER PathState::pushNode(
|
|||||||
const bool bIssuer = isSetBit(iType, STPathElement::typeIssuer);
|
const bool bIssuer = isSetBit(iType, STPathElement::typeIssuer);
|
||||||
TER terResult = tesSUCCESS;
|
TER terResult = tesSUCCESS;
|
||||||
|
|
||||||
cLog(lsDEBUG) << "pushNode> "
|
cLog(lsTRACE) << "pushNode> "
|
||||||
<< iType
|
<< iType
|
||||||
<< ": " << (bAccount ? RippleAddress::createHumanAccountID(uAccountID) : "-")
|
<< ": " << (bAccount ? RippleAddress::createHumanAccountID(uAccountID) : "-")
|
||||||
<< " " << (bCurrency ? STAmount::createHumanCurrency(uCurrencyID) : "-")
|
<< " " << (bCurrency ? STAmount::createHumanCurrency(uCurrencyID) : "-")
|
||||||
@@ -209,7 +209,7 @@ TER PathState::pushNode(
|
|||||||
|
|
||||||
if (!sleRippleState)
|
if (!sleRippleState)
|
||||||
{
|
{
|
||||||
cLog(lsINFO) << "pushNode: No credit line between "
|
cLog(lsTRACE) << "pushNode: No credit line between "
|
||||||
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
||||||
<< " and "
|
<< " and "
|
||||||
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
||||||
@@ -217,13 +217,13 @@ TER PathState::pushNode(
|
|||||||
<< STAmount::createHumanCurrency(pnCur.uCurrencyID)
|
<< STAmount::createHumanCurrency(pnCur.uCurrencyID)
|
||||||
<< "." ;
|
<< "." ;
|
||||||
|
|
||||||
cLog(lsINFO) << getJson();
|
cLog(lsTRACE) << getJson();
|
||||||
|
|
||||||
terResult = terNO_LINE;
|
terResult = terNO_LINE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cLog(lsINFO) << "pushNode: Credit line found between "
|
cLog(lsDEBUG) << "pushNode: Credit line found between "
|
||||||
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
||||||
<< " and "
|
<< " and "
|
||||||
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
||||||
@@ -280,7 +280,7 @@ TER PathState::pushNode(
|
|||||||
vpnNodes.push_back(pnCur);
|
vpnNodes.push_back(pnCur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cLog(lsINFO) << boost::str(boost::format("pushNode< : %s") % transToken(terResult));
|
cLog(lsDEBUG) << boost::str(boost::format("pushNode< : %s") % transToken(terResult));
|
||||||
|
|
||||||
return terResult;
|
return terResult;
|
||||||
}
|
}
|
||||||
@@ -1660,7 +1660,7 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
|||||||
? lesActive.rippleOwed(uCurAccountID, uNxtAccountID, uCurrencyID)
|
? lesActive.rippleOwed(uCurAccountID, uNxtAccountID, uCurrencyID)
|
||||||
: STAmount(uCurrencyID, uCurAccountID);
|
: STAmount(uCurrencyID, uCurAccountID);
|
||||||
|
|
||||||
cLog(lsDEBUG) << boost::str(boost::format("calcNodeAccountRev> uNode=%d/%d uPrvAccountID=%s uCurAccountID=%s uNxtAccountID=%s uCurrencyID=%s uQualityIn=%d uQualityOut=%d saPrvOwed=%s saPrvLimit=%s")
|
cLog(lsTRACE) << boost::str(boost::format("calcNodeAccountRev> uNode=%d/%d uPrvAccountID=%s uCurAccountID=%s uNxtAccountID=%s uCurrencyID=%s uQualityIn=%d uQualityOut=%d saPrvOwed=%s saPrvLimit=%s")
|
||||||
% uNode
|
% uNode
|
||||||
% uLast
|
% uLast
|
||||||
% RippleAddress::createHumanAccountID(uPrvAccountID)
|
% RippleAddress::createHumanAccountID(uPrvAccountID)
|
||||||
@@ -1695,14 +1695,14 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uNode, PathState& psCur, c
|
|||||||
const STAmount& saCurDeliverReq = pnCur.saRevDeliver;
|
const STAmount& saCurDeliverReq = pnCur.saRevDeliver;
|
||||||
STAmount saCurDeliverAct(saCurDeliverReq.getCurrency(), saCurDeliverReq.getIssuer());
|
STAmount saCurDeliverAct(saCurDeliverReq.getCurrency(), saCurDeliverReq.getIssuer());
|
||||||
|
|
||||||
cLog(lsDEBUG) << boost::str(boost::format("calcNodeAccountRev: saPrvRedeemReq=%s saPrvIssueReq=%s saCurRedeemReq=%s saCurIssueReq=%s saNxtOwed=%s")
|
cLog(lsTRACE) << boost::str(boost::format("calcNodeAccountRev: saPrvRedeemReq=%s saPrvIssueReq=%s saCurRedeemReq=%s saCurIssueReq=%s saNxtOwed=%s")
|
||||||
% saPrvRedeemReq.getFullText()
|
% saPrvRedeemReq.getFullText()
|
||||||
% saPrvIssueReq.getFullText()
|
% saPrvIssueReq.getFullText()
|
||||||
% saCurRedeemReq.getFullText()
|
% saCurRedeemReq.getFullText()
|
||||||
% saCurIssueReq.getFullText()
|
% saCurIssueReq.getFullText()
|
||||||
% saNxtOwed.getFullText());
|
% saNxtOwed.getFullText());
|
||||||
|
|
||||||
cLog(lsDEBUG) << psCur.getJson();
|
cLog(lsTRACE) << psCur.getJson();
|
||||||
|
|
||||||
assert(!saCurRedeemReq || (-saNxtOwed) >= saCurRedeemReq); // Current redeem req can't be more than IOUs on hand.
|
assert(!saCurRedeemReq || (-saNxtOwed) >= saCurRedeemReq); // Current redeem req can't be more than IOUs on hand.
|
||||||
assert(!saCurIssueReq // If not issuing, fine.
|
assert(!saCurIssueReq // If not issuing, fine.
|
||||||
|
|||||||
@@ -11,24 +11,32 @@ AccountItem::pointer RippleState::makeItem(const uint160& accountID, SerializedL
|
|||||||
}
|
}
|
||||||
|
|
||||||
RippleState::RippleState(SerializedLedgerEntry::ref ledgerEntry) : AccountItem(ledgerEntry),
|
RippleState::RippleState(SerializedLedgerEntry::ref ledgerEntry) : AccountItem(ledgerEntry),
|
||||||
mValid(false),
|
mValid(false), mViewLowest(true)
|
||||||
mViewLowest(true)
|
|
||||||
{
|
{
|
||||||
mFlags = mLedgerEntry->getFieldU32(sfFlags);
|
for (int i = 0, iMax = mLedgerEntry->getCount(); i < iMax; ++i)
|
||||||
|
{
|
||||||
|
const SerializedType* entry = mLedgerEntry->peekAtPIndex(i);
|
||||||
|
assert(entry);
|
||||||
|
|
||||||
mLowLimit = mLedgerEntry->getFieldAmount(sfLowLimit);
|
if (entry->getFName() == sfFlags)
|
||||||
mHighLimit = mLedgerEntry->getFieldAmount(sfHighLimit);
|
mFlags = static_cast<const STUInt32*>(entry)->getValue();
|
||||||
|
else if (entry->getFName() == sfLowLimit)
|
||||||
mLowID = RippleAddress::createAccountID(mLowLimit.getIssuer());
|
{
|
||||||
mHighID = RippleAddress::createAccountID(mHighLimit.getIssuer());
|
mLowLimit = *static_cast<const STAmount*>(entry);
|
||||||
|
mLowID = RippleAddress::createAccountID(mLowLimit.getIssuer());
|
||||||
mLowQualityIn = mLedgerEntry->getFieldU32(sfLowQualityIn);
|
}
|
||||||
mLowQualityOut = mLedgerEntry->getFieldU32(sfLowQualityOut);
|
else if (entry->getFName() == sfHighLimit)
|
||||||
|
{
|
||||||
mHighQualityIn = mLedgerEntry->getFieldU32(sfHighQualityIn);
|
mHighLimit = *static_cast<const STAmount*>(entry);
|
||||||
mHighQualityOut = mLedgerEntry->getFieldU32(sfHighQualityOut);
|
mHighID = RippleAddress::createAccountID(mHighLimit.getIssuer());
|
||||||
|
}
|
||||||
mBalance = mLedgerEntry->getFieldAmount(sfBalance);
|
else if (entry->getFName() == sfLowQualityIn)
|
||||||
|
mLowQualityIn = static_cast<const STUInt32*>(entry)->getValue();
|
||||||
|
else if (entry->getFName() == sfHighQualityIn)
|
||||||
|
mHighQualityIn = static_cast<const STUInt32*>(entry)->getValue();
|
||||||
|
else if (entry->getFName() == sfBalance)
|
||||||
|
mBalance = *static_cast<const STAmount*>(entry);
|
||||||
|
}
|
||||||
|
|
||||||
mValid = true;
|
mValid = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user