mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
fsm: add instanout fsm parsing
This commit is contained in:
parent
8c7c7cf8b5
commit
f725f07dd9
5 changed files with 49 additions and 4 deletions
|
|
@ -2,11 +2,11 @@
|
|||
stateDiagram-v2
|
||||
[*] --> InitFSM: OnRequestStuff
|
||||
InitFSM
|
||||
InitFSM --> StuffFailed: OnError
|
||||
InitFSM --> StuffSentOut: OnStuffSentOut
|
||||
InitFSM --> StuffFailed: OnError
|
||||
StuffFailed
|
||||
StuffSentOut
|
||||
StuffSentOut --> StuffFailed: OnError
|
||||
StuffSentOut --> StuffSuccess: OnStuffSuccess
|
||||
StuffSentOut --> StuffFailed: OnError
|
||||
StuffSuccess
|
||||
```
|
||||
|
|
@ -10,6 +10,7 @@ import (
|
|||
"sort"
|
||||
|
||||
"github.com/lightninglabs/loop/fsm"
|
||||
"github.com/lightninglabs/loop/instantout"
|
||||
"github.com/lightninglabs/loop/instantout/reservation"
|
||||
)
|
||||
|
||||
|
|
@ -49,6 +50,13 @@ func run() error {
|
|||
return err
|
||||
}
|
||||
|
||||
case "instantout":
|
||||
instantout := &instantout.FSM{}
|
||||
err = writeMermaidFile(fp, instantout.GetV1ReservationStates())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
default:
|
||||
fmt.Println("Missing or wrong argument: fsm must be one of:")
|
||||
fmt.Println("\treservations")
|
||||
|
|
|
|||
36
instantout/fsm.md
Normal file
36
instantout/fsm.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> Init: OnStart
|
||||
BuildHtlc
|
||||
BuildHtlc --> PushPreimage: OnHtlcSigReceived
|
||||
BuildHtlc --> InstantFailedOutFailed: OnError
|
||||
BuildHtlc --> InstantFailedOutFailed: OnRecover
|
||||
FailedHtlcSweep
|
||||
FinishedSweeplessSweep
|
||||
Init
|
||||
Init --> SendPaymentAndPollAccepted: OnInit
|
||||
Init --> InstantFailedOutFailed: OnError
|
||||
Init --> InstantFailedOutFailed: OnRecover
|
||||
InstantFailedOutFailed
|
||||
PublishHtlc
|
||||
PublishHtlc --> FailedHtlcSweep: OnError
|
||||
PublishHtlc --> PublishHtlc: OnRecover
|
||||
PublishHtlc --> WaitForHtlcSweepConfirmed: OnHtlcBroadcasted
|
||||
PushPreimage
|
||||
PushPreimage --> PushPreimage: OnRecover
|
||||
PushPreimage --> WaitForSweeplessSweepConfirmed: OnSweeplessSweepPublished
|
||||
PushPreimage --> InstantFailedOutFailed: OnError
|
||||
PushPreimage --> PublishHtlc: OnErrorPublishHtlc
|
||||
SendPaymentAndPollAccepted
|
||||
SendPaymentAndPollAccepted --> BuildHtlc: OnPaymentAccepted
|
||||
SendPaymentAndPollAccepted --> InstantFailedOutFailed: OnError
|
||||
SendPaymentAndPollAccepted --> InstantFailedOutFailed: OnRecover
|
||||
WaitForHtlcSweepConfirmed
|
||||
WaitForHtlcSweepConfirmed --> FinishedHtlcPreimageSweep: OnHtlcSwept
|
||||
WaitForHtlcSweepConfirmed --> WaitForHtlcSweepConfirmed: OnRecover
|
||||
WaitForHtlcSweepConfirmed --> FailedHtlcSweep: OnError
|
||||
WaitForSweeplessSweepConfirmed
|
||||
WaitForSweeplessSweepConfirmed --> FinishedSweeplessSweep: OnSweeplessSweepConfirmed
|
||||
WaitForSweeplessSweepConfirmed --> WaitForSweeplessSweepConfirmed: OnRecover
|
||||
WaitForSweeplessSweepConfirmed --> PublishHtlc: OnError
|
||||
```
|
||||
|
|
@ -7,9 +7,9 @@ Confirmed --> TimedOut: OnTimedOut
|
|||
Confirmed --> Confirmed: OnRecover
|
||||
Failed
|
||||
Init
|
||||
Init --> Failed: OnError
|
||||
Init --> WaitForConfirmation: OnBroadcast
|
||||
Init --> Failed: OnRecover
|
||||
Init --> Failed: OnError
|
||||
SpendBroadcasted
|
||||
SpendBroadcasted --> SpendConfirmed: OnSpendConfirmed
|
||||
SpendConfirmed
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
go run ./fsm/stateparser/stateparser.go --out ./fsm/example_fsm.md --fsm example
|
||||
go run ./fsm/stateparser/stateparser.go --out ./reservation/reservation_fsm.md --fsm reservation
|
||||
go run ./fsm/stateparser/stateparser.go --out ./reservation/reservation_fsm.md --fsm reservation
|
||||
go run ./fsm/stateparser/stateparser.go --out ./instantout/fsm.md --fsm instantout
|
||||
Loading…
Add table
Add a link
Reference in a new issue