Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit e91c37d

Browse files
committed
Resolve createChannel
1 parent 61ad824 commit e91c37d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/lightning-core/accounts/reducer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,24 @@ export const actions = {
174174
reject(err.message)
175175
}
176176

177+
const handleResolve = () => {
178+
dispatch(notificationActions.addNotification('Opening Channel'))
179+
resolve()
180+
}
177181

178182
dispatch(actions.listPeers())
179183
.then(({ peers }) => {
180184
const peer = _.find(peers, { pub_key: pubkey })
181185

182186
if (peer) {
183187
const call = dispatch(actions.openChannel({ pubkey, amount }))
184-
call.on('data', () => dispatch(notificationActions.addNotification('Opening Channel')))
188+
call.on('data', handleResolve)
185189
call.on('error', rejectError)
186190
} else {
187191
dispatch(actions.connectPeer({ host, pubkey }))
188192
.then(() => {
189193
const call = dispatch(actions.openChannel({ pubkey, amount }))
190-
call.on('data', () => dispatch(notificationActions.addNotification('Opening Channel')))
194+
call.on('data', handleResolve)
191195
call.on('error', rejectError)
192196
})
193197
.catch(rejectError)

0 commit comments

Comments
 (0)