mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 15:05:53 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -661,9 +661,9 @@ Json::Value callRPC(const std::string& strIp, const int iPort, const std::string
|
||||
if (!theConfig.QUIET)
|
||||
{
|
||||
std::cerr << "Connecting to: " << strIp << ":" << iPort << std::endl;
|
||||
std::cerr << "Username: " << strUsername << ":" << strPassword << std::endl;
|
||||
std::cerr << "Path: " << strPassword << std::endl;
|
||||
std::cerr << "Method: " << strMethod << std::endl;
|
||||
// std::cerr << "Username: " << strUsername << ":" << strPassword << std::endl;
|
||||
// std::cerr << "Path: " << strPath << std::endl;
|
||||
// std::cerr << "Method: " << strMethod << std::endl;
|
||||
}
|
||||
|
||||
boost::asio::ip::tcp::endpoint
|
||||
@@ -673,21 +673,23 @@ Json::Value callRPC(const std::string& strIp, const int iPort, const std::string
|
||||
if (stream.fail())
|
||||
throw std::runtime_error("couldn't connect to server");
|
||||
|
||||
cLog(lsDEBUG) << "connected" << std::endl;
|
||||
// cLog(lsDEBUG) << "connected" << std::endl;
|
||||
|
||||
// HTTP basic authentication
|
||||
std::string strUserPass64 = EncodeBase64(strUsername + ":" + strPassword);
|
||||
std::map<std::string, std::string> mapRequestHeaders;
|
||||
mapRequestHeaders["Authorization"] = std::string("Basic ") + strUserPass64;
|
||||
|
||||
cLog(lsDEBUG) << "requesting" << std::endl;
|
||||
// Log(lsDEBUG) << "requesting" << std::endl;
|
||||
|
||||
// Send request
|
||||
std::string strRequest = JSONRPCRequest(strMethod, params, Json::Value(1));
|
||||
cLog(lsDEBUG) << "send request " << strMethod << " : " << strRequest << std::endl;
|
||||
// cLog(lsDEBUG) << "send request " << strMethod << " : " << strRequest << std::endl;
|
||||
|
||||
std::string strPost = createHTTPPost(strPath, strRequest, mapRequestHeaders);
|
||||
stream << strPost << std::flush;
|
||||
|
||||
std::cerr << "post " << strPost << std::endl;
|
||||
// std::cerr << "post " << strPost << std::endl;
|
||||
|
||||
// Receive reply
|
||||
std::map<std::string, std::string> mapHeaders;
|
||||
|
||||
@@ -495,6 +495,118 @@ buster.testCase("Sending future", {
|
||||
// Ripple with one-way credit path.
|
||||
});
|
||||
|
||||
buster.testCase("Nexus", {
|
||||
// 'setUp' : testutils.build_setup({ verbose: true }),
|
||||
'setUp' : testutils.build_setup(),
|
||||
'tearDown' : testutils.build_teardown(),
|
||||
|
||||
"customer to customer with and without transfer fee" :
|
||||
function (done) {
|
||||
var self = this;
|
||||
|
||||
// self.remote.set_trace();
|
||||
|
||||
async.waterfall([
|
||||
function (callback) {
|
||||
self.what = "Create accounts.";
|
||||
|
||||
testutils.create_accounts(self.remote, "root", "10000.0", ["alice", "bob", "mtgox"], callback);
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Set credit limits.";
|
||||
|
||||
testutils.credit_limits(self.remote,
|
||||
{
|
||||
"alice" : "100/AUD/mtgox",
|
||||
"bob" : "100/AUD/mtgox",
|
||||
},
|
||||
callback);
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Distribute funds.";
|
||||
|
||||
testutils.payments(self.remote,
|
||||
{
|
||||
"mtgox" : [ "1/AUD/alice" ],
|
||||
},
|
||||
callback);
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Verify balances.";
|
||||
|
||||
testutils.verify_balances(self.remote,
|
||||
{
|
||||
"alice" : "1/AUD/mtgox",
|
||||
"mtgox" : "-1/AUD/alice",
|
||||
},
|
||||
callback);
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Alice sends Bob 1 AUD";
|
||||
|
||||
self.remote.transaction()
|
||||
.payment("alice", "bob", "1/AUD/mtgox")
|
||||
.on('proposed', function (m) {
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
|
||||
callback(m.result !== 'tesSUCCESS');
|
||||
})
|
||||
.submit();
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Verify balances 2.";
|
||||
|
||||
testutils.verify_balances(self.remote,
|
||||
{
|
||||
"alice" : "0/AUD/mtgox",
|
||||
"bob" : "1/AUD/mtgox",
|
||||
"mtgox" : "-1/AUD/bob",
|
||||
},
|
||||
callback);
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Set transfer rate.";
|
||||
|
||||
self.remote.transaction()
|
||||
.account_set("mtgox")
|
||||
.transfer_rate(1e9*1.1)
|
||||
.once('proposed', function (m) {
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
callback(m.result !== 'tesSUCCESS');
|
||||
})
|
||||
.submit();
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Bob sends Alice 0.5 AUD";
|
||||
|
||||
self.remote.transaction()
|
||||
.payment("bob", "alice", "0.5/AUD/mtgox")
|
||||
.send_max("0.55/AUD/mtgox") // !!! Very important.
|
||||
.on('proposed', function (m) {
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
|
||||
callback(m.result !== 'tesSUCCESS');
|
||||
})
|
||||
.submit();
|
||||
},
|
||||
function (callback) {
|
||||
self.what = "Verify balances 3.";
|
||||
|
||||
testutils.verify_balances(self.remote,
|
||||
{
|
||||
"alice" : "0.5/AUD/mtgox",
|
||||
"bob" : "0.45/AUD/mtgox",
|
||||
"mtgox" : [ "-0.5/AUD/alice","-0.45/AUD/bob" ],
|
||||
},
|
||||
callback);
|
||||
},
|
||||
], function (error) {
|
||||
buster.refute(error, self.what);
|
||||
done();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
buster.testCase("Indirect ripple", {
|
||||
// 'setUp' : testutils.build_setup({ verbose: true }),
|
||||
'setUp' : testutils.build_setup(),
|
||||
|
||||
Reference in New Issue
Block a user