@@ -701,6 +701,28 @@ module Channel =
701
701
| state, cmd ->
702
702
undefinedStateAndCmdPair state cmd
703
703
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
+
704
726
let applyEvent c ( e : ChannelEvent ): Channel =
705
727
match e, c.State with
706
728
| NewOutboundChannelStarted(_, data), WaitForInitInternal ->
@@ -727,28 +749,11 @@ module Channel =
727
749
| TheySentFundingLocked msg, WaitForFundingConfirmed s ->
728
750
{ c with State = WaitForFundingConfirmed({ s with Deferred = Some( msg) }) }
729
751
| 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
750
753
| WeSentFundingLocked msg, WaitForFundingLocked prevState ->
751
754
{ c with State = WaitForFundingLocked { prevState with OurMessage = msg; HaveWeSentFundingLocked = true } }
755
+ | WeResumedDelayedFundingLocked msg, WaitForFundingLocked s ->
756
+ bothFundingLocked c msg s
752
757
| BothFundingLocked data, WaitForFundingSigned _ s ->
753
758
{ c with State = ChannelState.Normal data }
754
759
| BothFundingLocked data, WaitForFundingLocked _ s ->
0 commit comments