Skip to content

Commit

Permalink
FIX: Filtering source_amount pathfind correctly
Browse files Browse the repository at this point in the history
Bug:

```js
api.connect().then(() => {
  const pathfind = {
    source: {
      address: USDCold,
      amount: {
        currency: 'USD',
        value: '1.00' // <<<< Rippled response has "1" not "1.00"
      }
    },
    destination: {
      address: EURCold,
      amount: {currency: 'EUR'}
    }
  };
  return api.getPaths(pathfind).then(paths => {
    console.log('PATHS: \n', JSON.stringify(paths, null, 2));
  });
}).catch(console.log);

```
  • Loading branch information
Alan Cohen committed Mar 21, 2016
1 parent 7e466bb commit 5b20fe5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ledger/pathfind.js
Expand Up @@ -93,7 +93,7 @@ function filterSourceFundsLowPaths(pathfind: PathFind,
paths.alternatives = _.filter(paths.alternatives, alt => {
return alt.source_amount &&
pathfind.source.amount &&
alt.source_amount.value === pathfind.source.amount.value;
new BigNumber(alt.source_amount.value).eq(pathfind.source.amount.value);
});
}
return paths;
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/requests/getpaths/send-all.json
Expand Up @@ -3,7 +3,7 @@
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"amount": {
"currency": "USD",
"value": "5"
"value": "5.00"
}
},
"destination": {
Expand Down

0 comments on commit 5b20fe5

Please sign in to comment.