Skip to content

Commit

Permalink
improved state awareness.
Browse files Browse the repository at this point in the history
  • Loading branch information
ardevd committed Feb 13, 2024
1 parent e438e11 commit e556945
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/tui/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,16 @@ func (m *ChannelModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, updateChannelPolicyMsg
case key.Matches(msg, Keymap.ForceClose):
// Force close channel
m.channelCloseForm = m.getChannelOperationForm("Force Close Channel", "Latest commitment transaction will be broadcast. Are you sure?")
m.state = ChannelStateWantClose
if m.state == ChannelStateNone {
m.channelCloseForm = m.getChannelOperationForm("Force Close Channel", "Latest commitment transaction will be broadcast. Are you sure?")
m.state = ChannelStateWantClose
}
case key.Matches(msg, Keymap.Close):
// Close channel
m.channelCloseForm = m.getChannelOperationForm("Close Channel", "A cooperative close will be issued. Are you sure?")
m.state = ChannelStateWantClose
if m.state == ChannelStateNone {
m.channelCloseForm = m.getChannelOperationForm("Close Channel", "A cooperative close will be issued. Are you sure?")
m.state = ChannelStateWantClose
}
}

// ChannelStatus update receive
Expand Down Expand Up @@ -441,7 +445,7 @@ func (m ChannelModel) getChannelPolicyForm() *huh.Form {
huh.NewInput().
Title("Time Lock Delta").
Prompt(">").
Validate(util.IsAmount).
Validate(util.IsChannelFeeAmount).
Value(&policyTimeLockDelta),
),
).WithShowHelp(false).WithShowErrors(true)
Expand Down

0 comments on commit e556945

Please sign in to comment.