Merge pull request #272 from ripple/fix-taker-gets-funded

Fix taker_gets_funded exceeding offer.TakerGets
This commit is contained in:
Geert Weening
2015-02-03 18:35:25 -08:00
3 changed files with 695 additions and 687 deletions

View File

@@ -25,11 +25,13 @@
"superagent": "^0.18.0"
},
"devDependencies": {
"assert-diff": "0.0.4",
"coveralls": "~2.10.0",
"gulp": "~3.6.2",
"gulp-bump": "~0.1.10",
"gulp-clean-dest": "^0.1.0",
"gulp-concat": "~2.2.0",
"gulp-eslint": "^0.2.0",
"gulp-filelog": "^0.4.1",
"gulp-flowtype": "^0.4.1",
"gulp-plumber": "^0.6.6",
@@ -38,7 +40,6 @@
"gulp-uglify": "~0.3.0",
"gulp-util": "^3.0.2",
"gulp-watch": "^3.0.0",
"gulp-eslint": "^0.2.0",
"istanbul": "~0.2.10",
"map-stream": "~0.1.0",
"mocha": "~1.14.0",

View File

@@ -439,7 +439,14 @@ OrderBook.prototype.setFundedAmount = function(offer, fundedAmount) {
return offer;
}
offer.taker_gets_funded = fundedAmount;
var isOfferGetsExceeded = Amount.from_json(fundedAmount)
.compareTo(offer.TakerGets) > 0;
if (isOfferGetsExceeded) {
offer.taker_gets_funded = offer.TakerGets;
} else {
offer.taker_gets_funded = fundedAmount;
}
var takerPaysValue = (typeof offer.TakerPays === 'object')
? offer.TakerPays.value

File diff suppressed because it is too large Load Diff