mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix sendMax path bug
This commit is contained in:
@@ -176,7 +176,9 @@ toStrand (
|
||||
STPathElement::typeAll, src, curIssue.currency, curIssue.account);
|
||||
|
||||
boost::optional<STPathElement> sendMaxPE;
|
||||
if (sendMaxIssue && sendMaxIssue->account != src)
|
||||
if (sendMaxIssue && sendMaxIssue->account != src &&
|
||||
(path.empty () || !path[0].isAccount () ||
|
||||
path[0].getAccountID () != sendMaxIssue->account))
|
||||
sendMaxPE.emplace (sendMaxIssue->account, boost::none, boost::none);
|
||||
|
||||
STPathElement const lastNode (dst, boost::none, boost::none);
|
||||
|
||||
@@ -363,6 +363,17 @@ struct Flow_test : public beast::unit_test::suite
|
||||
expect (r.first == tesSUCCESS);
|
||||
expect (equal (r.second, D{alice, gw, usdC}));
|
||||
}
|
||||
{
|
||||
// Check path with sendMax and node with correct sendMax already set
|
||||
Env env (*this, features(featureFlowV2), features(featureOwnerPaysFee));
|
||||
env.fund (XRP (10000), alice, bob, gw);
|
||||
env.trust (USD (1000), alice, bob);
|
||||
env.trust (EUR (1000), alice, bob);
|
||||
env (pay (gw, alice, EUR (100)));
|
||||
auto const path = STPath ({STPathElement (STPathElement::typeAll,
|
||||
EUR.account, EUR.currency, EUR.account)});
|
||||
test (env, USD, EUR.issue(), path, tesSUCCESS);
|
||||
}
|
||||
}
|
||||
void testDirectStep ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user