@@ -72,6 +72,11 @@ const (
7272 // StateFailInsufficientConfirmedBalance indicates that the swap wasn't
7373 // published due to insufficient confirmed balance.
7474 StateFailInsufficientConfirmedBalance SwapState = 12
75+
76+ // StateFailIncorrectHtlcAmtSwept indicates that the amount of an
77+ // externally published loop in htlc that didn't match the swap amount
78+ // has been swept back to the user after the htlc timeout period.
79+ StateFailIncorrectHtlcAmtSwept SwapState = 13
7580)
7681
7782// SwapStateType defines the types of swap states that exist. Every swap state
@@ -92,10 +97,7 @@ const (
9297
9398// Type returns the type of the SwapState it is called on.
9499func (s SwapState ) Type () SwapStateType {
95- if s == StateInitiated || s == StateHtlcPublished ||
96- s == StatePreimageRevealed || s == StateFailTemporary ||
97- s == StateInvoiceSettled {
98-
100+ if s .IsPending () {
99101 return StateTypePending
100102 }
101103
@@ -110,7 +112,7 @@ func (s SwapState) Type() SwapStateType {
110112func (s SwapState ) IsPending () bool {
111113 return s == StateInitiated || s == StateHtlcPublished ||
112114 s == StatePreimageRevealed || s == StateFailTemporary ||
113- s == StateInvoiceSettled
115+ s == StateInvoiceSettled || s == StateFailIncorrectHtlcAmt
114116}
115117
116118// IsFinal returns true if the swap is in a final state.
@@ -160,6 +162,9 @@ func (s SwapState) String() string {
160162 case StateFailInsufficientConfirmedBalance :
161163 return "InsufficientConfirmedBalance"
162164
165+ case StateFailIncorrectHtlcAmtSwept :
166+ return "StateFailIncorrectHtlcAmtSwept"
167+
163168 default :
164169 return "Unknown"
165170 }
0 commit comments