From 8747b0a5d2aa003ac5e437f101476f3bf4cc0310 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sat, 20 Apr 2013 15:43:27 -0700 Subject: [PATCH] JS: Fix request_ripple_balance() setting issuer. --- src/js/remote.js | 8 ++++---- test/send-test.js | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/js/remote.js b/src/js/remote.js index 14efb3d045..e57e2f54b1 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -1164,11 +1164,11 @@ Remote.prototype.request_ripple_balance = function (account, issuer, currency, c var accountHigh = UInt160.from_json(account).equals(highLimit.issuer()); request.emit('ripple_state', { - 'account_balance' : ( accountHigh ? balance.negate() : balance).parse_issuer(account), - 'peer_balance' : (!accountHigh ? balance.negate() : balance).parse_issuer(issuer), + 'account_balance' : ( accountHigh ? balance.negate() : balance.clone()).parse_issuer(account), + 'peer_balance' : (!accountHigh ? balance.negate() : balance.clone()).parse_issuer(issuer), - 'account_limit' : ( accountHigh ? highLimit : lowLimit).parse_issuer(issuer), - 'peer_limit' : (!accountHigh ? highLimit : lowLimit).parse_issuer(account), + 'account_limit' : ( accountHigh ? highLimit : lowLimit).clone().parse_issuer(issuer), + 'peer_limit' : (!accountHigh ? highLimit : lowLimit).clone().parse_issuer(account), 'account_quality_in' : ( accountHigh ? node.HighQualityIn : node.LowQualityIn), 'peer_quality_in' : (!accountHigh ? node.HighQualityIn : node.LowQualityIn), diff --git a/test/send-test.js b/test/send-test.js index 2c2c390a82..7e2c251d69 100644 --- a/test/send-test.js +++ b/test/send-test.js @@ -372,7 +372,7 @@ buster.testCase("Sending future", { .submit(); }, function (callback) { - self.what = "Verify balance from alice's pov."; + self.what = "Verify balance from alice's pov: 1"; self.remote.request_ripple_balance("alice", "bob", "USD", 'CURRENT') .once('ripple_state', function (m) { @@ -397,7 +397,7 @@ buster.testCase("Sending future", { .submit(); }, function (callback) { - self.what = "Verify balance from alice's pov."; + self.what = "Verify balance from alice's pov: 2"; self.remote.request_ripple_balance("alice", "bob", "USD", 'CURRENT') .once('ripple_state', function (m) { @@ -422,7 +422,7 @@ buster.testCase("Sending future", { .submit(); }, function (callback) { - self.what = "Verify balance from alice's pov."; + self.what = "Verify balance from alice's pov: 3"; self.remote.request_ripple_balance("alice", "bob", "USD", 'CURRENT') .once('ripple_state', function (m) { @@ -445,7 +445,7 @@ buster.testCase("Sending future", { .submit(); }, function (callback) { - self.what = "Verify balance from alice's pov."; + self.what = "Verify balance from alice's pov: 4"; self.remote.request_ripple_balance("alice", "bob", "USD", 'CURRENT') .once('ripple_state', function (m) { @@ -467,7 +467,7 @@ buster.testCase("Sending future", { // .ledger_accept(); // }, // function (callback) { -// self.what = "Verify balance from alice's pov."; +// self.what = "Verify balance from alice's pov: 5"; // // self.remote.request_ripple_balance("alice", "bob", "USD", 'CURRENT') // .once('ripple_state', function (m) {