mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Ignore offers with TakerGets of 0
This commit is contained in:
@@ -683,9 +683,14 @@ OrderBook.prototype.requestOffers = function(callback) {
|
||||
log.info('requested offers', self._key, 'offers: ' + res.offers.length);
|
||||
}
|
||||
|
||||
self._offers = res.offers.map(function addOffer(offer) {
|
||||
for (var i=0, l=res.offers.length; i<l; i++) {
|
||||
var offer = res.offers[i];
|
||||
var fundedAmount;
|
||||
|
||||
if (Amount.from_json(offer.TakerGets).to_text() === '0') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self.hasCachedFunds(offer.Account)) {
|
||||
fundedAmount = self.getCachedFunds(offer.Account);
|
||||
} else if (offer.hasOwnProperty('owner_funds')) {
|
||||
@@ -695,9 +700,8 @@ OrderBook.prototype.requestOffers = function(callback) {
|
||||
|
||||
self.setFundedAmount(offer, fundedAmount);
|
||||
self.incrementOfferCount(offer.Account);
|
||||
|
||||
return offer;
|
||||
});
|
||||
self._offers.push(offer);
|
||||
}
|
||||
|
||||
self._synchronized = true;
|
||||
|
||||
@@ -1007,6 +1011,10 @@ OrderBook.prototype.notify = function(message) {
|
||||
break;
|
||||
|
||||
case 'CreatedNode':
|
||||
if (Amount.from_json(node.fields.TakerGets).to_text() === '0') {
|
||||
return callback();
|
||||
}
|
||||
|
||||
self.incrementOfferCount(node.fields.Account);
|
||||
|
||||
var fundedAmount = message.transaction.owner_funds;
|
||||
|
||||
Reference in New Issue
Block a user