mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Work on ripple paths.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "SerializedTypes.h"
|
||||
#include "SerializedObject.h"
|
||||
#include "TransactionFormats.h"
|
||||
#include "Log.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "utils.h"
|
||||
|
||||
@@ -308,7 +309,11 @@ STPathSet* STPathSet::construct(SerializerIterator& s, const char *name)
|
||||
if (iType == STPathElement::typeEnd || iType == STPathElement::typeBoundary)
|
||||
{
|
||||
if (path.empty())
|
||||
{
|
||||
Log(lsINFO) << "STPathSet: Empty path.";
|
||||
|
||||
throw std::runtime_error("empty path");
|
||||
}
|
||||
|
||||
paths.push_back(path);
|
||||
path.clear();
|
||||
@@ -320,13 +325,15 @@ STPathSet* STPathSet::construct(SerializerIterator& s, const char *name)
|
||||
}
|
||||
else if (iType & ~STPathElement::typeValidBits)
|
||||
{
|
||||
Log(lsINFO) << "STPathSet: Bad path element: " << iType;
|
||||
|
||||
throw std::runtime_error("bad path element");
|
||||
}
|
||||
else
|
||||
{
|
||||
bool bAccount = !!(iType & STPathElement::typeAccount);
|
||||
bool bCurrency = !!(iType & STPathElement::typeCurrency);
|
||||
bool bIssuer = !!(iType & STPathElement::typeIssuer);
|
||||
const bool bAccount = !!(iType & STPathElement::typeAccount);
|
||||
const bool bCurrency = !!(iType & STPathElement::typeCurrency);
|
||||
const bool bIssuer = !!(iType & STPathElement::typeIssuer);
|
||||
|
||||
uint160 uAccountID;
|
||||
uint160 uCurrency;
|
||||
|
||||
@@ -1969,14 +1969,14 @@ bool TransactionEngine::calcNodeOfferRev(
|
||||
if (!saCurOfrFunds)
|
||||
{
|
||||
// Offer is unfunded.
|
||||
Log(lsINFO) << "calcNodeOffer: encountered unfunded offer";
|
||||
Log(lsINFO) << "calcNodeOfferRev: encountered unfunded offer";
|
||||
|
||||
// XXX Mark unfunded.
|
||||
}
|
||||
else if (sleCurOfr->getIFieldPresent(sfExpiration) && sleCurOfr->getIFieldU32(sfExpiration) <= mLedger->getParentCloseTimeNC())
|
||||
{
|
||||
// Offer is expired.
|
||||
Log(lsINFO) << "calcNodeOffer: encountered expired offer";
|
||||
Log(lsINFO) << "calcNodeOfferRev: encountered expired offer";
|
||||
|
||||
// XXX Mark unfunded.
|
||||
}
|
||||
@@ -3774,8 +3774,10 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
|
||||
if (!bNoRippleDirect)
|
||||
{
|
||||
// Direct path.
|
||||
// XXX Might also make a stamp bridge by default.
|
||||
Log(lsINFO) << "doPayment: Build direct:";
|
||||
vpsPaths.push_back(PathState::createPathState(
|
||||
|
||||
PathState::pointer pspDirect = PathState::createPathState(
|
||||
mLedger,
|
||||
vpsPaths.size(),
|
||||
mNodes,
|
||||
@@ -3784,14 +3786,19 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
|
||||
mTxnAccountID,
|
||||
saDstAmount,
|
||||
saMaxAmount,
|
||||
bPartialPayment
|
||||
));
|
||||
bPartialPayment);
|
||||
|
||||
if (pspDirect)
|
||||
vpsPaths.push_back(pspDirect);
|
||||
}
|
||||
|
||||
Log(lsINFO) << "doPayment: Paths: " << spsPaths.getPathCount();
|
||||
|
||||
BOOST_FOREACH(const STPath& spPath, spsPaths)
|
||||
{
|
||||
Log(lsINFO) << "doPayment: Build path:";
|
||||
vpsPaths.push_back(PathState::createPathState(
|
||||
|
||||
PathState::pointer pspExpanded = PathState::createPathState(
|
||||
mLedger,
|
||||
vpsPaths.size(),
|
||||
mNodes,
|
||||
@@ -3800,8 +3807,10 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
|
||||
mTxnAccountID,
|
||||
saDstAmount,
|
||||
saMaxAmount,
|
||||
bPartialPayment
|
||||
));
|
||||
bPartialPayment);
|
||||
|
||||
if (pspExpanded)
|
||||
vpsPaths.push_back(pspExpanded);
|
||||
}
|
||||
|
||||
TransactionEngineResult terResult;
|
||||
@@ -3885,7 +3894,7 @@ TransactionEngineResult TransactionEngine::doWalletAdd(const SerializedTransacti
|
||||
|
||||
if (!naMasterPubKey.accountPublicVerify(Serializer::getSHA512Half(uAuthKeyID.begin(), uAuthKeyID.size()), vucSignature))
|
||||
{
|
||||
std::cerr << "WalletAdd: unauthorized: bad signature " << std::endl;
|
||||
std::cerr << "WalletAdd: unauthorized: bad signature " << std::endl;
|
||||
|
||||
return tenBAD_ADD_AUTH;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,11 @@ public:
|
||||
STAmount saSendMax,
|
||||
bool bPartialPayment
|
||||
)
|
||||
{ return boost::make_shared<PathState>(lpLedger, iIndex, lesSource, spSourcePath, uReceiverID, uSenderID, saSend, saSendMax, bPartialPayment); };
|
||||
{
|
||||
PathState::pointer pspNew = boost::make_shared<PathState>(lpLedger, iIndex, lesSource, spSourcePath, uReceiverID, uSenderID, saSend, saSendMax, bPartialPayment);
|
||||
|
||||
return pspNew && pspNew->bValid ? pspNew : PathState::pointer();
|
||||
}
|
||||
|
||||
static bool lessPriority(const PathState::pointer& lhs, const PathState::pointer& rhs);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user