Skip to content

Commit

Permalink
fix(raiden): getRoutes amount comparison
Browse files Browse the repository at this point in the history
In this PR we fix an issue where `SwapClient.getRoutes` method received
units (smallest unit per currency) and was comparing them to amounts
(satoshis per coin).
  • Loading branch information
Karl Ranna committed Jul 18, 2019
1 parent ab78f26 commit eb25249
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/raidenclient/RaidenClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class RaidenClient extends SwapClient {
// not implemented, raiden does not use invoices
}

public getRoutes = async (amount: number, destination: string, currency: string) => {
public getRoutes = async (units: number, destination: string, currency: string) => {
// a query routes call is not currently provided by raiden

/** A placeholder route value that assumes a fixed lock time of 100 Raiden's blocks. */
Expand All @@ -212,6 +212,11 @@ class RaidenClient extends SwapClient {
};

if (this.directChannelChecks) {
// convert received units to amount
const amount = this.unitConverter.unitsToAmount({
currency,
units,
});
// temporary check for a direct channel in raiden
const tokenAddress = this.tokenAddresses.get(currency);
const channels = await this.getChannels(tokenAddress);
Expand Down

0 comments on commit eb25249

Please sign in to comment.