|
35 | 35 | fsm.OnError: {},
|
36 | 36 | OnWithdrawInitiated: {},
|
37 | 37 | OnWithdrawn: {},
|
| 38 | + OnOpeningChannel: {}, |
| 39 | + OnChannelPublished: {}, |
38 | 40 | }
|
39 | 41 | )
|
40 | 42 |
|
|
51 | 53 | // Withdrawn signals that the withdrawal transaction has been confirmed.
|
52 | 54 | Withdrawn = fsm.StateType("Withdrawn")
|
53 | 55 |
|
| 56 | + // OpeningChannel signals that the open channel transaction has been |
| 57 | + // broadcast. |
| 58 | + OpeningChannel = fsm.StateType("OpeningChannel") |
| 59 | + |
| 60 | + // ChannelPublished signals that the open channel transaction has been |
| 61 | + // published and that the channel should be managed from lnd from now |
| 62 | + // on. |
| 63 | + ChannelPublished = fsm.StateType("ChannelPublished") |
| 64 | + |
54 | 65 | // LoopingIn signals that the deposit is locked for a loop in swap.
|
55 | 66 | LoopingIn = fsm.StateType("LoopingIn")
|
56 | 67 |
|
@@ -93,6 +104,15 @@ var (
|
93 | 104 | // OnWithdrawn is sent to the fsm when a withdrawal has been confirmed.
|
94 | 105 | OnWithdrawn = fsm.EventType("OnWithdrawn")
|
95 | 106 |
|
| 107 | + // OnOpeningChannel is sent to the fsm when a channel open has been |
| 108 | + // initiated. |
| 109 | + OnOpeningChannel = fsm.EventType("OnOpeningChannel") |
| 110 | + |
| 111 | + // OnChannelPublished is sent to the fsm when a channel open has been |
| 112 | + // published. Loop has done its work here and the channel should now be |
| 113 | + // managed from lnd. |
| 114 | + OnChannelPublished = fsm.EventType("OnChannelPublished") |
| 115 | + |
96 | 116 | // OnLoopInInitiated is sent to the fsm when a loop in has been
|
97 | 117 | // initiated.
|
98 | 118 | OnLoopInInitiated = fsm.EventType("OnLoopInInitiated")
|
@@ -253,6 +273,7 @@ func (f *FSM) DepositStatesV0() fsm.States {
|
253 | 273 | OnExpiry: PublishExpirySweep,
|
254 | 274 | OnWithdrawInitiated: Withdrawing,
|
255 | 275 | OnLoopInInitiated: LoopingIn,
|
| 276 | + OnOpeningChannel: OpeningChannel, |
256 | 277 | // We encounter OnSweepingHtlcTimeout if the
|
257 | 278 | // server published the htlc tx without paying
|
258 | 279 | // us. We then need to monitor for the timeout
|
@@ -366,6 +387,17 @@ func (f *FSM) DepositStatesV0() fsm.States {
|
366 | 387 | },
|
367 | 388 | Action: f.FinalizeDepositAction,
|
368 | 389 | },
|
| 390 | + OpeningChannel: fsm.State{ |
| 391 | + Transitions: fsm.Transitions{ |
| 392 | + fsm.OnError: Deposited, |
| 393 | + OnChannelPublished: ChannelPublished, |
| 394 | + OnRecover: OpeningChannel, |
| 395 | + }, |
| 396 | + Action: fsm.NoOpAction, |
| 397 | + }, |
| 398 | + ChannelPublished: fsm.State{ |
| 399 | + Action: fsm.NoOpAction, |
| 400 | + }, |
369 | 401 | }
|
370 | 402 | }
|
371 | 403 |
|
|
0 commit comments