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

Commit

Permalink
Merge 545285f into 2211f09
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyMow committed Aug 29, 2018
2 parents 2211f09 + 545285f commit 0a05b6b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/lib/lnd/methods/invoicesController.js
Expand Up @@ -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)
}
Expand Down
14 changes: 13 additions & 1 deletion 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'
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions test/unit/reducers/__snapshots__/activity.spec.js.snap
Expand Up @@ -29,6 +29,7 @@ Object {
},
"searchActive": false,
"searchText": "",
"showExpiredRequests": false,
}
`;

Expand Down Expand Up @@ -63,6 +64,7 @@ Object {
},
"searchActive": false,
"searchText": "",
"showExpiredRequests": false,
}
`;

Expand Down Expand Up @@ -98,6 +100,7 @@ Object {
},
"searchActive": false,
"searchText": "",
"showExpiredRequests": false,
}
`;

Expand Down Expand Up @@ -132,6 +135,7 @@ Object {
},
"searchActive": false,
"searchText": "",
"showExpiredRequests": false,
}
`;

Expand Down Expand Up @@ -167,6 +171,7 @@ Object {
},
"searchActive": false,
"searchText": "",
"showExpiredRequests": false,
}
`;

Expand Down Expand Up @@ -202,6 +207,7 @@ Object {
},
"searchActive": undefined,
"searchText": "",
"showExpiredRequests": false,
}
`;

Expand Down Expand Up @@ -237,5 +243,6 @@ Object {
},
"searchActive": false,
"searchText": undefined,
"showExpiredRequests": false,
}
`;

0 comments on commit 0a05b6b

Please sign in to comment.