mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-02 10:05:49 +00:00
Merge pull request #143 from ripple/develop
Update unfunded order tracking
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -996,7 +996,8 @@ describe('OrderBook', function() {
|
||||
|
||||
book.on('offer_funds_changed', function(offer, previousFunds, newFunds) {
|
||||
assert.strictEqual(previousFunds, '100');
|
||||
assert.strictEqual(newFunds, '10');
|
||||
assert.strictEqual(newFunds, offer.taker_gets_funded);
|
||||
assert.notStrictEqual(previousFunds, newFunds);
|
||||
switch (++receivedFundsChangedEvents) {
|
||||
case 1:
|
||||
assert(!offer.is_fully_funded);
|
||||
@@ -1130,7 +1131,8 @@ describe('OrderBook', function() {
|
||||
|
||||
book.on('offer_funds_changed', function(offer, previousFunds, newFunds) {
|
||||
assert.strictEqual(previousFunds, '100');
|
||||
assert.strictEqual(newFunds, '25');
|
||||
assert.strictEqual(newFunds, offer.taker_gets_funded);
|
||||
assert.notStrictEqual(previousFunds, newFunds);
|
||||
switch (++receivedFundsChangedEvents) {
|
||||
case 1:
|
||||
assert(!offer.is_fully_funded);
|
||||
|
||||
Reference in New Issue
Block a user