Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
[FIX] source_slippage should default to zero
Browse files Browse the repository at this point in the history
- A SendMax value is calculated using source_slippage, but that is an
  optional parameter.

- Typical client error:

```json
{
   "success": false,
   "error_type": "transaction",
   "error": "plus() not a number: undefined"
}
```
  • Loading branch information
Alan Cohen committed Mar 30, 2015
1 parent 2323be8 commit 4087fab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion api/lib/rest-to-tx-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ RestToTxConverter.prototype.convert = function(payment, callback) {
&& payment.source_amount.counterparty
=== payment.destination_amount.counterparty)) {
var max_value = bignum(payment.source_amount.value)
.plus(payment.source_slippage).toString();
.plus(payment.source_slippage || 0).toString();
if (payment.source_amount.currency === 'XRP') {
transaction.sendMax(utils.xrpToDrops(max_value));
} else {
Expand Down
1 change: 0 additions & 1 deletion test/unit/fixtures/rest-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ module.exports.exportsPaymentRestIssuers = function(options) {
destinationAccount: addresses.COUNTERPARTY,
sourceIssuer: addresses.VALID,
destinationIssuer: addresses.COUNTERPARTY,
sourceSlippage: '0',
sourceValue: '10'
});

Expand Down

0 comments on commit 4087fab

Please sign in to comment.