Browse Source

fix(contacts): force close offline contacts

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
200b8cad09
  1. 2
      app/components/Contacts/ContactModal.js
  2. 4
      app/lnd/methods/channelController.js
  3. 5
      app/reducers/channels.js

2
app/components/Contacts/ContactModal.js

@ -114,7 +114,7 @@ const ContactModal = ({
</div>
</span>
:
<div onClick={() => closeChannel({ channel_point: channel.channel_point, chan_id: channel.chan_id })}>Remove</div>
<div onClick={() => closeChannel({ channel_point: channel.channel_point, chan_id: channel.chan_id, force: !channel.active })}>Remove</div>
}
</footer>
</div>

4
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) => {

5
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
}
}

Loading…
Cancel
Save