-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show pending channels on dashboard (#40)
- Loading branch information
Showing
5 changed files
with
177 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package lnd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/btcsuite/btcd/btcutil" | ||
) | ||
|
||
// ChannelType represents the type of Lightning network channel. | ||
type PendingChannelType int | ||
|
||
const ( | ||
// PendingOpen indicates a pending channel opening. | ||
PendingOpen PendingChannelType = iota | ||
// CooperativeClosure indicates a cooperative channel closure. | ||
CooperativeClosure | ||
// ForceClosure indicates a forceful channel closure. | ||
ForceClosure | ||
) | ||
|
||
type PendingChannel struct { | ||
Capacity btcutil.Amount | ||
LocalBalance btcutil.Amount | ||
RecoveredBalance btcutil.Amount | ||
LimboBalance btcutil.Amount | ||
BlocksUntilMaturity int32 | ||
Type PendingChannelType | ||
Alias string | ||
} | ||
|
||
func (c PendingChannel) FilterValue() string { | ||
return c.Alias | ||
} | ||
|
||
func (c PendingChannel) Title() string { | ||
return c.Alias | ||
} | ||
|
||
func (c PendingChannel) Description() string { | ||
switch c.Type { | ||
case PendingOpen: | ||
return "Opening" | ||
case CooperativeClosure: | ||
return "Closing" | ||
case ForceClosure: | ||
return fmt.Sprintf("Force closing (%d sats in limbo)", | ||
int(c.LimboBalance.ToUnit(btcutil.AmountSatoshi))) | ||
} | ||
|
||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters