Browse Source

Merge pull request #454 from LN-Zap/fix/channel-details-in-prod

fix(channels): fix invalid assignment error that was not allowing cha…
renovate/lint-staged-8.x
Ben Woosley 7 years ago
committed by GitHub
parent
commit
074576ba6a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      app/components/Contacts/Network.js

26
app/components/Contacts/Network.js

@ -80,48 +80,48 @@ class Network extends Component {
} }
// when the user clicks the action to close the channel // when the user clicks the action to close the channel
const removeClicked = channel => { const removeClicked = removeChannel => {
closeChannel({ channel_point: channel.channel_point, chan_id: channel.chan_id, force: !channel.active }) closeChannel({ channel_point: removeChannel.channel_point, chan_id: removeChannel.chan_id, force: !removeChannel.active })
} }
// when a user clicks a channel // when a user clicks a channel
const channelClicked = channel => { const channelClicked = clickedChannel => {
// selectedChannel === channel ? setSelectedChannel(null) : setSelectedChannel(channel) // selectedChannel === channel ? setSelectedChannel(null) : setSelectedChannel(channel)
if (selectedChannel === channel) { if (selectedChannel === clickedChannel) {
setSelectedChannel(null) setSelectedChannel(null)
} else { } else {
setSelectedChannel(channel) setSelectedChannel(clickedChannel)
} }
} }
const displayNodeName = channel => { const displayNodeName = displayedChannel => {
const node = find(nodes, n => channel.remote_pubkey === n.pub_key) const node = find(nodes, n => displayedChannel.remote_pubkey === n.pub_key)
if (node && node.alias.length) { if (node && node.alias.length) {
return node.alias return node.alias
} }
return channel.remote_pubkey ? channel.remote_pubkey.substring(0, 10) : channel.remote_node_pub.substring(0, 10) return displayedChannel.remote_pubkey ? displayedChannel.remote_pubkey.substring(0, 10) : displayedChannel.remote_node_pub.substring(0, 10)
} }
const channelStatus = channel => { const channelStatus = statusChannel => {
// if the channel has a confirmation_height property that means it's pending // if the channel has a confirmation_height property that means it's pending
if (Object.prototype.hasOwnProperty.call(channel, 'confirmation_height')) { if (Object.prototype.hasOwnProperty.call(statusChannel, 'confirmation_height')) {
return 'pending' return 'pending'
} }
// if the channel has a closing tx that means it's closing // if the channel has a closing tx that means it's closing
if (Object.prototype.hasOwnProperty.call(channel, 'closing_txid')) { if (Object.prototype.hasOwnProperty.call(statusChannel, 'closing_txid')) {
return 'closing' return 'closing'
} }
// if we are in the process of closing this channel // if we are in the process of closing this channel
if (closingChannelIds.includes(channel.chan_id)) { if (closingChannelIds.includes(statusChannel.chan_id)) {
return 'closing' return 'closing'
} }
// if the channel isn't active that means the remote peer isn't online // if the channel isn't active that means the remote peer isn't online
if (!channel.active) { if (!statusChannel.active) {
return 'offline' return 'offline'
} }

Loading…
Cancel
Save