From dbac12ed7869c4acc7c17a81ca4dd1b153522907 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 19 Feb 2026 09:53:55 +0100 Subject: [PATCH] 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. --- staticaddr/deposit/fsm.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/staticaddr/deposit/fsm.go b/staticaddr/deposit/fsm.go index 029f7f63..341283a3 100644 --- a/staticaddr/deposit/fsm.go +++ b/staticaddr/deposit/fsm.go @@ -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, }, }