Skip to content

Commit

Permalink
fix: could not find route for private channels (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Apr 26, 2019
1 parent 575b4a5 commit 1eeb4ee
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/swap/SwapManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ class SwapManager {
this.logger.silly(`Sending ${sendingCurrency.symbol} on Lightning and receiving ${receivingCurrency.symbol} on the chain`);

const { blocks } = await receivingCurrency.chainClient.getBlockchainInfo();
const { paymentHash, numSatoshis, destination } = await sendingCurrency.lndClient.decodePayReq(invoice);
const { paymentHash, numSatoshis, destination, routeHintsList } = await sendingCurrency.lndClient.decodePayReq(invoice);

const routable = await this.checkRoutability(sendingCurrency.lndClient, destination, numSatoshis);
// If there are route hints the routability check could fail although the LND could pay the invoice
if (routeHintsList.length !== 0) {
const routable = await this.checkRoutability(sendingCurrency.lndClient, destination, numSatoshis);

if (!routable) {
throw Errors.NO_ROUTE_FOUND();
if (!routable) {
throw Errors.NO_ROUTE_FOUND();
}
}

this.logger.verbose(`Creating new Swap from ${receivingCurrency.symbol} to ${sendingCurrency.symbol} with preimage hash: ${paymentHash}`);
Expand Down

0 comments on commit 1eeb4ee

Please sign in to comment.