@@ -72,6 +72,11 @@ const (
72
72
// StateFailInsufficientConfirmedBalance indicates that the swap wasn't
73
73
// published due to insufficient confirmed balance.
74
74
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
75
80
)
76
81
77
82
// SwapStateType defines the types of swap states that exist. Every swap state
@@ -92,10 +97,7 @@ const (
92
97
93
98
// Type returns the type of the SwapState it is called on.
94
99
func (s SwapState ) Type () SwapStateType {
95
- if s == StateInitiated || s == StateHtlcPublished ||
96
- s == StatePreimageRevealed || s == StateFailTemporary ||
97
- s == StateInvoiceSettled {
98
-
100
+ if s .IsPending () {
99
101
return StateTypePending
100
102
}
101
103
@@ -110,7 +112,7 @@ func (s SwapState) Type() SwapStateType {
110
112
func (s SwapState ) IsPending () bool {
111
113
return s == StateInitiated || s == StateHtlcPublished ||
112
114
s == StatePreimageRevealed || s == StateFailTemporary ||
113
- s == StateInvoiceSettled
115
+ s == StateInvoiceSettled || s == StateFailIncorrectHtlcAmt
114
116
}
115
117
116
118
// IsFinal returns true if the swap is in a final state.
@@ -160,6 +162,9 @@ func (s SwapState) String() string {
160
162
case StateFailInsufficientConfirmedBalance :
161
163
return "InsufficientConfirmedBalance"
162
164
165
+ case StateFailIncorrectHtlcAmtSwept :
166
+ return "StateFailIncorrectHtlcAmtSwept"
167
+
163
168
default :
164
169
return "Unknown"
165
170
}
0 commit comments