diff --git a/app/lib/lnd/methods/invoicesController.js b/app/lib/lnd/methods/invoicesController.js index d8cb1415..77fe392e 100644 --- a/app/lib/lnd/methods/invoicesController.js +++ b/app/lib/lnd/methods/invoicesController.js @@ -7,9 +7,9 @@ import pushinvoices from '../push/subscribeinvoice' * @param value [description] * @return [description] */ -export function addInvoice(lnd, { memo, value }) { +export function addInvoice(lnd, { memo, value, private: privateInvoice }) { return new Promise((resolve, reject) => { - lnd.addInvoice({ memo, value }, (err, data) => { + lnd.addInvoice({ memo, value, private: privateInvoice }, (err, data) => { if (err) { return reject(err) } diff --git a/app/reducers/invoice.js b/app/reducers/invoice.js index ed85d177..160b633c 100644 --- a/app/reducers/invoice.js +++ b/app/reducers/invoice.js @@ -1,6 +1,7 @@ import { createSelector } from 'reselect' import { ipcRenderer } from 'electron' import { push } from 'react-router-redux' +import Store from 'electron-store' import { showNotification } from 'lib/utils/notifications' import { btc } from 'lib/utils' @@ -118,7 +119,18 @@ export const createInvoice = (amount, memo, currency) => dispatch => { const value = btc.convert(currency, 'sats', amount) dispatch(sendInvoice()) - ipcRenderer.send('lnd', { msg: 'createInvoice', data: { value, memo } }) + + // Grab the activeConnection type from our local store. If the active connection type is local (light clients using + // neutrino) we will have to flag private as true when creating this invoice. All light cliets open private channels + // (both manual and autopilot ones). In order for these clients to receive money through these channels the invoices + // need to come with routing hints for private channels + const store = new Store({ name: 'settings' }) + const { type } = store.get('activeConnection', {}) + + ipcRenderer.send('lnd', { + msg: 'createInvoice', + data: { value, memo, private: type === 'local' } + }) } // Receive IPC event for newly created invoice diff --git a/test/unit/reducers/__snapshots__/activity.spec.js.snap b/test/unit/reducers/__snapshots__/activity.spec.js.snap index c41e52d6..9e4010e3 100644 --- a/test/unit/reducers/__snapshots__/activity.spec.js.snap +++ b/test/unit/reducers/__snapshots__/activity.spec.js.snap @@ -29,6 +29,7 @@ Object { }, "searchActive": false, "searchText": "", + "showExpiredRequests": false, } `; @@ -63,6 +64,7 @@ Object { }, "searchActive": false, "searchText": "", + "showExpiredRequests": false, } `; @@ -98,6 +100,7 @@ Object { }, "searchActive": false, "searchText": "", + "showExpiredRequests": false, } `; @@ -132,6 +135,7 @@ Object { }, "searchActive": false, "searchText": "", + "showExpiredRequests": false, } `; @@ -167,6 +171,7 @@ Object { }, "searchActive": false, "searchText": "", + "showExpiredRequests": false, } `; @@ -202,6 +207,7 @@ Object { }, "searchActive": undefined, "searchText": "", + "showExpiredRequests": false, } `; @@ -237,5 +243,6 @@ Object { }, "searchActive": false, "searchText": undefined, + "showExpiredRequests": false, } `;