-
Notifications
You must be signed in to change notification settings - Fork 216
fix(channels): neutrino clients manual channels flagged private #699
Conversation
Pull Request Test Coverage Report for Build 3819
💛 - Coveralls |
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions and comment on the code @JimmyMow
.flowconfig
Outdated
@@ -9,6 +9,7 @@ | |||
<PROJECT_ROOT>/dll/.* | |||
<PROJECT_ROOT>/release/.* | |||
<PROJECT_ROOT>/git/.* | |||
<PROJECT_ROOT>/.git/.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
@@ -19,13 +19,14 @@ function ensurePeerConnected(lnd, pubkey, host) { | |||
* @return {[type]} [description] | |||
*/ | |||
export function connectAndOpen(lnd, event, payload) { | |||
const { pubkey, host, localamt } = payload | |||
const { pubkey, host, localamt, private: privateChannel } = payload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to change the variable name to privateChannel
? Can't it just remain named private
? especially as that is what we want it to be named when we pass it into lnd.openChannel
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because private is a reserved word in strict mode
app/reducers/channels.js
Outdated
// like remote node and BTCPay Server we will announce to the network as | ||
// these users are using Zap to drive nodes that are online 24/7 | ||
const store = new Store({ name: 'settings' }) | ||
const { type } = store.get('activeConnection', null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If activeConnection
is not set in the store, store.get
should return an empty object, instead of null
const { type } = store.get('activeConnection',{})
Otherwise, we would be trying to destructure null
which would cause an error.
flow-typed/module_vx.x.x.js
Outdated
@@ -1,3 +1,3 @@ | |||
declare module 'module' { | |||
declare module 'grpc' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably create a new file for this rather than modifying the existing flowtype for module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to remove this as this was fixed in a diff PR and merged
test/unit/reducers/channels.spec.js
Outdated
@@ -8,6 +10,16 @@ import channelsReducer, { | |||
OPENING_FAILURE | |||
} from 'reducers/channels' | |||
|
|||
jest.mock('electron', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed any longer as we've added a manual mock for electron here: https://github.com/LN-Zap/zap-desktop/blob/master/test/unit/__mocks__/electron.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
app/reducers/channels.js
Outdated
@@ -191,7 +192,18 @@ export const openChannel = ({ pubkey, host, local_amt }) => (dispatch, getState) | |||
dispatch(openingChannel()) | |||
dispatch(addLoadingPubkey(pubkey)) | |||
|
|||
ipcRenderer.send('lnd', { msg: 'connectAndOpen', data: { pubkey, host, localamt } }) | |||
// Grab the activeConnection type from our local store. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Line length should be 120.
c956da1
to
ad062c2
Compare
Make sure that if a user of ours is using neutrino that we flag their channels as private when they manually open them. Reason for this is because light consumer clients are not expected to have high uptime. However we cannot hardcode channels as private every time because we do support more power users driving their remote nodes or BTCPay Server with Zap. So we only flag channels as private if the activeConnection is local.
ad062c2
to
9b837ba
Compare
Tested ACK 9b837ba |
This PR we make sure that if a user of ours is using neutrino that we flag their channels as private when they manually open them. Reason for this is because light consumer clients are not expected to have high uptime.
However we cannot hardcode channels as private every time because we do support more power users driving their remote nodes or BTCPay Server with Zap. So we only flag channels as private if the
activeConnection
islocal
.Addresses #681