-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
instantout: republish sweepless sweep #745
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,10 @@ var ( | |
// PushPreimage is the state where the preimage is pushed to the server. | ||
PushPreimage = fsm.StateType("PushPreimage") | ||
|
||
// PublishSweeplessSweep is the state where the sweepless sweep is | ||
// published. | ||
PublishSweeplessSweep = fsm.StateType("PublishSweeplessSweep") | ||
|
||
// WaitForSweeplessSweepConfirmed is the state where we wait for the | ||
// sweepless sweep to be confirmed. | ||
WaitForSweeplessSweepConfirmed = fsm.StateType( | ||
|
@@ -105,9 +109,9 @@ var ( | |
// is received. | ||
OnHtlcSigReceived = fsm.EventType("OnHtlcSigReceived") | ||
|
||
// OnPreimagePushed is the event that is triggered when the preimage | ||
// is pushed to the server. | ||
OnPreimagePushed = fsm.EventType("OnPreimagePushed") | ||
// OnSweeplessSweepBuilt is the event that is triggered when the preimage | ||
// is pushed to the server and the sweepless sweep tx has been built. | ||
OnSweeplessSweepBuilt = fsm.EventType("OnPreimagePushed") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix event name |
||
|
||
// OnSweeplessSweepPublished is the event that is triggered when the | ||
// sweepless sweep is published. | ||
|
@@ -267,17 +271,25 @@ func (f *FSM) GetV1ReservationStates() fsm.States { | |
}, | ||
PushPreimage: fsm.State{ | ||
Transitions: fsm.Transitions{ | ||
OnSweeplessSweepPublished: WaitForSweeplessSweepConfirmed, | ||
fsm.OnError: Failed, | ||
OnErrorPublishHtlc: PublishHtlc, | ||
OnRecover: PushPreimage, | ||
OnSweeplessSweepBuilt: PublishSweeplessSweep, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is cleaner if we extract the sweepless sweep tx creation from |
||
fsm.OnError: Failed, | ||
OnErrorPublishHtlc: PublishHtlc, | ||
OnRecover: PushPreimage, | ||
}, | ||
Action: f.PushPreimageAction, | ||
}, | ||
PublishSweeplessSweep: fsm.State{ | ||
Transitions: fsm.Transitions{ | ||
OnSweeplessSweepPublished: WaitForSweeplessSweepConfirmed, | ||
fsm.OnError: PublishHtlc, | ||
OnRecover: PublishSweeplessSweep, | ||
}, | ||
Action: f.PublishSweeplessSweepAction, | ||
}, | ||
WaitForSweeplessSweepConfirmed: fsm.State{ | ||
Transitions: fsm.Transitions{ | ||
OnSweeplessSweepConfirmed: FinishedSweeplessSweep, | ||
OnRecover: WaitForSweeplessSweepConfirmed, | ||
OnRecover: PublishSweeplessSweep, | ||
fsm.OnError: PublishHtlc, | ||
}, | ||
Action: f.WaitForSweeplessSweepConfirmedAction, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ fsm.EventContext
fixes lll