From d416f31801a220805874e019b6cc6ba9d993255b Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Tue, 19 Aug 2014 14:28:11 -0700 Subject: [PATCH] Fix total account funds being emitted on offer_funds_changed rather than the amount set as taker_gets_funded --- src/js/ripple/orderbook.js | 3 ++- test/orderbook-test.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/ripple/orderbook.js b/src/js/ripple/orderbook.js index 542cce79..5ac0517d 100644 --- a/src/js/ripple/orderbook.js +++ b/src/js/ripple/orderbook.js @@ -89,6 +89,7 @@ function OrderBook(remote, getsC, getsI, paysC, paysI, key) { this._remote.on('disconnect', function() { self._ownerFunds = { }; + self._offerCounts = { }; self._synchronized = false; }); @@ -940,7 +941,7 @@ OrderBook.prototype.updateOfferFunds = function(account, fundedAmount) { this.emit( 'offer_funds_changed', offer, previousOffer.taker_gets_funded, - fundedAmount + offer.taker_gets_funded ); } } diff --git a/test/orderbook-test.js b/test/orderbook-test.js index 94b101d3..78c2264d 100644 --- a/test/orderbook-test.js +++ b/test/orderbook-test.js @@ -996,7 +996,7 @@ describe('OrderBook', function() { book.on('offer_funds_changed', function(offer, previousFunds, newFunds) { assert.strictEqual(previousFunds, '100'); - assert.strictEqual(newFunds, '10'); + assert.strictEqual(newFunds, '4.9656112525'); switch (++receivedFundsChangedEvents) { case 1: assert(!offer.is_fully_funded); @@ -1130,7 +1130,7 @@ describe('OrderBook', function() { book.on('offer_funds_changed', function(offer, previousFunds, newFunds) { assert.strictEqual(previousFunds, '100'); - assert.strictEqual(newFunds, '25'); + assert.strictEqual(newFunds, '10'); switch (++receivedFundsChangedEvents) { case 1: assert(!offer.is_fully_funded);