@@ -701,6 +701,28 @@ module Channel =
701701 | state, cmd ->
702702 undefinedStateAndCmdPair state cmd
703703
704+ let bothFundingLocked c ( msg : FundingLocked ) ( s : WaitForFundingLockedData ): Channel =
705+ let feeBase = ChannelHelpers.getOurFeeBaseMSat c.FeeEstimator s.InitialFeeRatePerKw s.Commitments.LocalParams.IsFunder
706+ let channelUpdate = ChannelHelpers.makeChannelUpdate ( c.Network.GenesisHashRev,
707+ c.LocalNodeSecret,
708+ c.RemoteNodeId,
709+ s.ShortChannelId,
710+ s.Commitments.LocalParams.ToSelfDelay,
711+ s.Commitments.RemoteParams.HTLCMinimumMSat,
712+ feeBase,
713+ c.Config.ChannelOptions.FeeProportionalMillionths,
714+ true ,
715+ None)
716+ let nextState = { NormalData.Buried = false ;
717+ Commitments = s.Commitments
718+ ShortChannelId = s.ShortChannelId
719+ ChannelAnnouncement = None
720+ ChannelUpdate = channelUpdate
721+ LocalShutdown = None
722+ RemoteShutdown = None
723+ ChannelId = msg.ChannelId }
724+ { c with State = ChannelState.Normal nextState }
725+
704726 let applyEvent c ( e : ChannelEvent ): Channel =
705727 match e, c.State with
706728 | NewOutboundChannelStarted(_, data), WaitForInitInternal ->
@@ -727,28 +749,11 @@ module Channel =
727749 | TheySentFundingLocked msg, WaitForFundingConfirmed s ->
728750 { c with State = WaitForFundingConfirmed({ s with Deferred = Some( msg) }) }
729751 | TheySentFundingLocked msg, WaitForFundingLocked s ->
730- let feeBase = ChannelHelpers.getOurFeeBaseMSat c.FeeEstimator s.InitialFeeRatePerKw s.Commitments.LocalParams.IsFunder
731- let channelUpdate = ChannelHelpers.makeChannelUpdate ( c.Network.GenesisHashRev,
732- c.LocalNodeSecret,
733- c.RemoteNodeId,
734- s.ShortChannelId,
735- s.Commitments.LocalParams.ToSelfDelay,
736- s.Commitments.RemoteParams.HTLCMinimumMSat,
737- feeBase,
738- c.Config.ChannelOptions.FeeProportionalMillionths,
739- true ,
740- None)
741- let nextState = { NormalData.Buried = false ;
742- Commitments = s.Commitments
743- ShortChannelId = s.ShortChannelId
744- ChannelAnnouncement = None
745- ChannelUpdate = channelUpdate
746- LocalShutdown = None
747- RemoteShutdown = None
748- ChannelId = msg.ChannelId }
749- { c with State = ChannelState.Normal nextState }
752+ bothFundingLocked c msg s
750753 | WeSentFundingLocked msg, WaitForFundingLocked prevState ->
751754 { c with State = WaitForFundingLocked { prevState with OurMessage = msg; HaveWeSentFundingLocked = true } }
755+ | WeResumedDelayedFundingLocked msg, WaitForFundingLocked s ->
756+ bothFundingLocked c msg s
752757 | BothFundingLocked data, WaitForFundingSigned _ s ->
753758 { c with State = ChannelState.Normal data }
754759 | BothFundingLocked data, WaitForFundingLocked _ s ->
0 commit comments