lnwallet/chancloser: ignore spurious channel flushed events

If we go to close while the channel is already flushed, we might get an extra event, so we can safely ignore it and do a self state transition.
This commit is contained in:
Olaoluwa Osuntokun 2024-03-07 20:10:27 -08:00
parent 73e622a31e
commit 7fc62840de

View file

@ -582,6 +582,12 @@ func (c *ClosingNegotiation) ProcessEvent(event ProtocolEvent, env *Environment,
// we receive a confirmation event, or we receive a signal to restart
// the co-op close process.
switch msg := event.(type) {
// Ignore any potential duplicate channel flushed events.
case *ChannelFlushed:
return &CloseStateTransition{
NextState: c,
}, nil
// If we get a confirmation, then the spend request we issued when we
// were leaving the ChannelFlushing state has been confirmed. We'll
// now transition to the StateFin state.