From 200b8cad0918611fa561a62be0e61eef5d75f15a Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Tue, 9 Jan 2018 13:22:30 -0600 Subject: [PATCH] fix(contacts): force close offline contacts --- app/components/Contacts/ContactModal.js | 2 +- app/lnd/methods/channelController.js | 4 ++-- app/reducers/channels.js | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/components/Contacts/ContactModal.js b/app/components/Contacts/ContactModal.js index 664cf920..ec0c4417 100644 --- a/app/components/Contacts/ContactModal.js +++ b/app/components/Contacts/ContactModal.js @@ -114,7 +114,7 @@ const ContactModal = ({ : -
closeChannel({ channel_point: channel.channel_point, chan_id: channel.chan_id })}>Remove
+
closeChannel({ channel_point: channel.channel_point, chan_id: channel.chan_id, force: !channel.active })}>Remove
} diff --git a/app/lnd/methods/channelController.js b/app/lnd/methods/channelController.js index 5085af22..fc3ee68e 100644 --- a/app/lnd/methods/channelController.js +++ b/app/lnd/methods/channelController.js @@ -112,14 +112,14 @@ export function listChannels(lnd, meta) { * @return {[type]} [description] */ export function closeChannel(lnd, meta, event, payload) { - const { chan_id } = payload + const { chan_id, force } = payload const tx = payload.channel_point.funding_txid.match(/.{2}/g).reverse().join('') const res = { channel_point: { funding_txid: BufferUtil.hexToBuffer(tx), output_index: Number(payload.channel_point.output_index) }, - force: false + force } return new Promise((resolve, reject) => { diff --git a/app/reducers/channels.js b/app/reducers/channels.js index 2f0092df..d82e76bf 100644 --- a/app/reducers/channels.js +++ b/app/reducers/channels.js @@ -195,10 +195,12 @@ export const pushchannelstatus = (event, data) => (dispatch) => { // eslint-disa } // Send IPC event for opening a channel -export const closeChannel = ({ channel_point, chan_id }) => (dispatch) => { +export const closeChannel = ({ channel_point, chan_id, force }) => (dispatch) => { dispatch(closingChannel()) dispatch(addClosingChanId(chan_id)) + console.log('force: ', force) + const [funding_txid, output_index] = channel_point.split(':') ipcRenderer.send( 'lnd', @@ -209,6 +211,7 @@ export const closeChannel = ({ channel_point, chan_id }) => (dispatch) => { funding_txid, output_index }, + force, chan_id } }