mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
deposit: add OnExpiry self-transitions to OpeningChannel and ChannelPublished
Both OpeningChannel and ChannelPublished lacked OnExpiry transitions. handleBlockNotification fires OnExpiry on every new block once the deposit is expired, regardless of the current state. Since both states use NoOpAction or FinalizeDepositAction which release the FSM mutex briefly, an OnExpiry SendEvent can sneak in. Add self-transitions so the event is safely absorbed.
This commit is contained in:
parent
52d884cec1
commit
dbac12ed78
1 changed files with 12 additions and 0 deletions
|
|
@ -392,10 +392,22 @@ func (f *FSM) DepositStatesV0() fsm.States {
|
|||
fsm.OnError: Deposited,
|
||||
OnChannelPublished: ChannelPublished,
|
||||
OnRecover: OpeningChannel,
|
||||
// OnExpiry can arrive on every block once
|
||||
// the deposit is expired. Since the channel
|
||||
// open is still in progress we absorb the
|
||||
// event as a self-transition.
|
||||
OnExpiry: OpeningChannel,
|
||||
},
|
||||
Action: fsm.NoOpAction,
|
||||
},
|
||||
ChannelPublished: fsm.State{
|
||||
Transitions: fsm.Transitions{
|
||||
// OnExpiry can arrive on every block once
|
||||
// the deposit is expired. Since the channel
|
||||
// is already published we absorb the event
|
||||
// as a self-transition.
|
||||
OnExpiry: ChannelPublished,
|
||||
},
|
||||
Action: f.FinalizeDepositAction,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue