mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-22 12:05:53 +00:00
UT: Tests for ripple-client issue #23.
This commit is contained in:
@@ -77,9 +77,7 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit)
|
|||||||
RippleAddress naSeed;
|
RippleAddress naSeed;
|
||||||
RippleAddress raSrcAddressID;
|
RippleAddress raSrcAddressID;
|
||||||
|
|
||||||
cLog(lsDEBUG)
|
cLog(lsDEBUG) << boost::str(boost::format("transactionSign: %s") % jvRequest);
|
||||||
<< boost::str(boost::format("transactionSign: %s")
|
|
||||||
% jvRequest);
|
|
||||||
|
|
||||||
if (!jvRequest.isMember("secret") || !jvRequest.isMember("tx_json"))
|
if (!jvRequest.isMember("secret") || !jvRequest.isMember("tx_json"))
|
||||||
{
|
{
|
||||||
@@ -177,15 +175,15 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit)
|
|||||||
|
|
||||||
Pathfinder pf(raSrcAddressID, dstAccountID, saSendMax.getCurrency(), saSendMax.getIssuer(), saSend);
|
Pathfinder pf(raSrcAddressID, dstAccountID, saSendMax.getCurrency(), saSendMax.getIssuer(), saSend);
|
||||||
|
|
||||||
if (!pf.findPaths(5, 3, spsPaths))
|
if (!pf.findPaths(7, 3, spsPaths))
|
||||||
{
|
{
|
||||||
cLog(lsDEBUG) << "payment: build_path: No paths found.";
|
cLog(lsDEBUG) << "transactionSign: build_path: No paths found.";
|
||||||
|
|
||||||
return rpcError(rpcNO_PATH);
|
return rpcError(rpcNO_PATH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cLog(lsDEBUG) << "payment: build_path: " << spsPaths.getJson(0);
|
cLog(lsDEBUG) << "transactionSign: build_path: " << spsPaths.getJson(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!spsPaths.isEmpty())
|
if (!spsPaths.isEmpty())
|
||||||
@@ -1146,7 +1144,7 @@ Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest)
|
|||||||
STPathSet spsComputed;
|
STPathSet spsComputed;
|
||||||
Pathfinder pf(raSrc, raDst, uSrcCurrencyID, uSrcIssuerID, saDstAmount);
|
Pathfinder pf(raSrc, raDst, uSrcCurrencyID, uSrcIssuerID, saDstAmount);
|
||||||
|
|
||||||
if (!pf.findPaths(5, 3, spsComputed))
|
if (!pf.findPaths(7, 3, spsComputed))
|
||||||
{
|
{
|
||||||
cLog(lsDEBUG) << "ripple_path_find: No paths found.";
|
cLog(lsDEBUG) << "ripple_path_find: No paths found.";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -769,9 +769,7 @@ buster.testCase("Issues", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
"//Path negative: Issue #23: smaller" :
|
"Path negative: ripple-client issue #23: smaller" :
|
||||||
// alice -120 USD-> michael -25 USD-> amy
|
|
||||||
// alice -25 USD-> Bill -75 USD -> Sam -100 USD-> Amy
|
|
||||||
//
|
//
|
||||||
// alice -- limit 40 --> bob
|
// alice -- limit 40 --> bob
|
||||||
// alice --> carol --> dan --> bob
|
// alice --> carol --> dan --> bob
|
||||||
@@ -792,20 +790,22 @@ buster.testCase("Issues", {
|
|||||||
testutils.credit_limits(self.remote,
|
testutils.credit_limits(self.remote,
|
||||||
{
|
{
|
||||||
"bob" : [ "40/USD/alice", "20/USD/dan" ],
|
"bob" : [ "40/USD/alice", "20/USD/dan" ],
|
||||||
"dan" : [ "20/USD/carol" ],
|
|
||||||
"carol" : [ "20/USD/alice" ],
|
"carol" : [ "20/USD/alice" ],
|
||||||
|
"dan" : [ "20/USD/carol" ],
|
||||||
},
|
},
|
||||||
callback);
|
callback);
|
||||||
},
|
},
|
||||||
function (callback) {
|
function (callback) {
|
||||||
self.what = "Distribute funds.";
|
self.what = "Payment.";
|
||||||
|
|
||||||
testutils.payments(self.remote,
|
self.remote.transaction()
|
||||||
{
|
.payment('alice', 'bob', "55/USD/bob")
|
||||||
// 4. acct 2 sent acct 3 a 75 iou
|
.build_path(true)
|
||||||
"alice" : "55/USD/bob",
|
.once('proposed', function (m) {
|
||||||
},
|
// console.log("proposed: %s", JSON.stringify(m));
|
||||||
callback);
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
},
|
},
|
||||||
function (callback) {
|
function (callback) {
|
||||||
self.what = "Verify balances.";
|
self.what = "Verify balances.";
|
||||||
@@ -826,6 +826,73 @@ buster.testCase("Issues", {
|
|||||||
// callback();
|
// callback();
|
||||||
// })
|
// })
|
||||||
// .request();
|
// .request();
|
||||||
|
// },
|
||||||
|
], function (error) {
|
||||||
|
buster.refute(error, self.what);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
"Path negative: ripple-client issue #23: larger" :
|
||||||
|
//
|
||||||
|
// alice -120 USD-> amazon -25 USD-> bob
|
||||||
|
// alice -25 USD-> carol -75 USD -> dan -100 USD-> bob
|
||||||
|
//
|
||||||
|
function (done) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
async.waterfall([
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Create accounts.";
|
||||||
|
|
||||||
|
testutils.create_accounts(self.remote, "root", "10000.0", ["alice", "bob", "carol", "dan", "amazon"], callback);
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Set credit limits.";
|
||||||
|
|
||||||
|
testutils.credit_limits(self.remote,
|
||||||
|
{
|
||||||
|
"amazon" : [ "120/USD/alice" ],
|
||||||
|
"bob" : [ "25/USD/amazon", "100/USD/dan" ],
|
||||||
|
"carol" : [ "25/USD/alice" ],
|
||||||
|
"dan" : [ "75/USD/carol" ],
|
||||||
|
},
|
||||||
|
callback);
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Payment.";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.payment('alice', 'bob', "50/USD/bob")
|
||||||
|
.build_path(true)
|
||||||
|
.once('proposed', function (m) {
|
||||||
|
// console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Verify balances.";
|
||||||
|
|
||||||
|
testutils.verify_balances(self.remote,
|
||||||
|
{
|
||||||
|
"alice" : [ "-25/USD/amazon", "-25/USD/carol" ],
|
||||||
|
"bob" : [ "25/USD/amazon", "25/USD/dan" ],
|
||||||
|
"carol" : [ "25/USD/alice", "-25/USD/dan" ],
|
||||||
|
"dan" : [ "25/USD/carol", "-25/USD/bob" ],
|
||||||
|
},
|
||||||
|
callback);
|
||||||
|
},
|
||||||
|
// function (callback) {
|
||||||
|
// self.what = "Display ledger";
|
||||||
|
//
|
||||||
|
// self.remote.request_ledger('current', true)
|
||||||
|
// .on('success', function (m) {
|
||||||
|
// console.log("Ledger: %s", JSON.stringify(m, undefined, 2));
|
||||||
|
//
|
||||||
|
// callback();
|
||||||
|
// })
|
||||||
|
// .request();
|
||||||
// },
|
// },
|
||||||
], function (error) {
|
], function (error) {
|
||||||
buster.refute(error, self.what);
|
buster.refute(error, self.what);
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ buster.testCase("Sending future", {
|
|||||||
// Ripple with one-way credit path.
|
// Ripple with one-way credit path.
|
||||||
});
|
});
|
||||||
|
|
||||||
buster.testCase("Nexus", {
|
buster.testCase("Gateway", {
|
||||||
// 'setUp' : testutils.build_setup({ verbose: true }),
|
// 'setUp' : testutils.build_setup({ verbose: true }),
|
||||||
'setUp' : testutils.build_setup(),
|
'setUp' : testutils.build_setup(),
|
||||||
'tearDown' : testutils.build_teardown(),
|
'tearDown' : testutils.build_teardown(),
|
||||||
|
|||||||
Reference in New Issue
Block a user