mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopd: new loopin state for incorrect amount sweeps
This commit is contained in:
parent
6f3c68fb21
commit
755d5dc68e
2 changed files with 13 additions and 5 deletions
|
|
@ -72,6 +72,11 @@ const (
|
|||
// StateFailInsufficientConfirmedBalance indicates that the swap wasn't
|
||||
// published due to insufficient confirmed balance.
|
||||
StateFailInsufficientConfirmedBalance SwapState = 12
|
||||
|
||||
// StateFailIncorrectHtlcAmtSwept indicates that the amount of an
|
||||
// externally published loop in htlc that didn't match the swap amount
|
||||
// has been swept back to the user after the htlc timeout period.
|
||||
StateFailIncorrectHtlcAmtSwept SwapState = 13
|
||||
)
|
||||
|
||||
// SwapStateType defines the types of swap states that exist. Every swap state
|
||||
|
|
@ -92,10 +97,7 @@ const (
|
|||
|
||||
// Type returns the type of the SwapState it is called on.
|
||||
func (s SwapState) Type() SwapStateType {
|
||||
if s == StateInitiated || s == StateHtlcPublished ||
|
||||
s == StatePreimageRevealed || s == StateFailTemporary ||
|
||||
s == StateInvoiceSettled {
|
||||
|
||||
if s.IsPending() {
|
||||
return StateTypePending
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +112,7 @@ func (s SwapState) Type() SwapStateType {
|
|||
func (s SwapState) IsPending() bool {
|
||||
return s == StateInitiated || s == StateHtlcPublished ||
|
||||
s == StatePreimageRevealed || s == StateFailTemporary ||
|
||||
s == StateInvoiceSettled
|
||||
s == StateInvoiceSettled || s == StateFailIncorrectHtlcAmt
|
||||
}
|
||||
|
||||
// IsFinal returns true if the swap is in a final state.
|
||||
|
|
@ -160,6 +162,9 @@ func (s SwapState) String() string {
|
|||
case StateFailInsufficientConfirmedBalance:
|
||||
return "InsufficientConfirmedBalance"
|
||||
|
||||
case StateFailIncorrectHtlcAmtSwept:
|
||||
return "StateFailIncorrectHtlcAmtSwept"
|
||||
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue