channels

package
v0.13.1-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MEMPOOL string = "https://mempool.space/lightning/channel/"
	AMBOSS  string = "https://amboss.space/edge/"
	ONEML   string = "https://1ml.com/channel/"
)

Variables

This section is empty.

Functions

func AddChannelOrUpdateChannelStatus added in v0.10.0

func AddChannelOrUpdateChannelStatus(db *sqlx.DB, channel Channel) (int, error)

func CloseChannel added in v0.7.0

func CloseChannel(eventChannel chan interface{}, db *sqlx.DB, c *gin.Context, ccReq CloseChannelRequest, reqId string) (err error)

func GetClosureStatus added in v0.10.0

func GetClosureStatus(lndClosureType lnrpc.ChannelCloseSummary_ClosureType) commons.ChannelStatus

GetClosureStatus returns Closing when our API is outdated and a new lnrpc.ChannelCloseSummary_ClosureType is added

func GetNodePeerAlias added in v0.12.0

func GetNodePeerAlias(localNodeId int, remoteNodeId int, db *sqlx.DB) (string, error)

func InitializeManagedChannelCache added in v0.10.0

func InitializeManagedChannelCache(db *sqlx.DB) error

func OpenChannel added in v0.7.0

func OpenChannel(db *sqlx.DB, eventChannel chan interface{}, req OpenChannelRequest, reqId string) (err error)

func RegisterChannelRoutes

func RegisterChannelRoutes(r *gin.RouterGroup, db *sqlx.DB)

func UpdateChannelStatus added in v0.10.0

func UpdateChannelStatus(db *sqlx.DB, channelId int, status commons.ChannelStatus) error

Types

type BatchOpenRequest added in v0.7.3

type BatchOpenRequest struct {
	NodeId      int                `json:"nodeId"`
	Channels    []batchOpenChannel `json:"channels"`
	TargetConf  *int32             `json:"targetConf"`
	SatPerVbyte *int64             `json:"satPerVbyte"`
}

type BatchOpenResponse added in v0.7.3

type BatchOpenResponse struct {
	PendingChannels []pendingChannel `json:"pendingChannels"`
}

type Channel

type Channel struct {
	// ChannelID A database primary key. NOT a channel_id as specified in BOLT 2
	ChannelID int `json:"channelId" db:"channel_id"`
	// ShortChannelID In the c-lighting and BOLT format e.g. 505580:1917:1
	ShortChannelID         *string               `json:"shortChannelId" db:"short_channel_id"`
	FundingTransactionHash string                `json:"fundingTransactionHash" db:"funding_transaction_hash"`
	FundingOutputIndex     int                   `json:"fundingOutputIndex" db:"funding_output_index"`
	ClosingTransactionHash *string               `json:"closingTransactionHash" db:"closing_transaction_hash"`
	LNDShortChannelID      *uint64               `json:"lndShortChannelId" db:"lnd_short_channel_id"`
	Capacity               int64                 `json:"capacity" db:"capacity"`
	Private                bool                  `json:"private" db:"private"`
	FirstNodeId            int                   `json:"firstNodeId" db:"first_node_id"`
	SecondNodeId           int                   `json:"secondNodeId" db:"second_node_id"`
	InitiatingNodeId       *int                  `json:"initiatingNodeId" db:"initiating_node_id"`
	AcceptingNodeId        *int                  `json:"acceptingNodeId" db:"accepting_node_id"`
	ClosingNodeId          *int                  `json:"closingNodeId" db:"closing_node_id"`
	Status                 commons.ChannelStatus `json:"status" db:"status_id"`
	CreatedOn              time.Time             `json:"createdOn" db:"created_on"`
	UpdateOn               *time.Time            `json:"updatedOn" db:"updated_on"`
}

func GetAllChannels added in v0.10.0

func GetAllChannels(db *sqlx.DB) (channels []Channel, err error)

func GetChannel added in v0.14.0

func GetChannel(db *sqlx.DB, channelId int) (Channel, error)

func GetChannels added in v0.13.0

func GetChannels(db *sqlx.DB, all bool, channelIds []int) ([]*Channel, error)

func GetOpenChannelsForNodeId added in v0.10.0

func GetOpenChannelsForNodeId(db *sqlx.DB, nodeId int) (channels []Channel, err error)

type ChannelPolicy added in v0.12.0

type ChannelPolicy struct {
	Disabled        bool   `json:"disabled" db:"disabled"`
	TimeLockDelta   uint32 `json:"timeLockDelta" db:"time_lock_delta"`
	MinHtlc         int64  `json:"minHtlc" db:"min_htlc"`
	MaxHtlcMsat     uint64 `json:"maxHtlcMsat" db:"max_htlc_msat"`
	FeeRateMillMsat uint64 `json:"feeRateMillMsat" db:"fee_rate_mill_msat"`
	ShortChannelId  string `json:"shortChannelId" db:"short_channel_id"`
	FeeBaseMsat     uint64 `json:"feeBaseMsat" db:"fee_base_msat"`
	NodeId          int    `json:"nodeId" db:"node_id"`
	RemoteNodeId    int    `json:"RemoteodeId" db:"remote_node_id"`
}

func GetLocalRoutingPolicy added in v0.12.1

func GetLocalRoutingPolicy(channelId, nodeId int, db *sqlx.DB) (ChannelPolicy, error)

func GetRemoteRoutingPolicy added in v0.12.1

func GetRemoteRoutingPolicy(channelId, nodeId int, db *sqlx.DB) (ChannelPolicy, error)

type CloseChannelRequest added in v0.7.3

type CloseChannelRequest struct {
	NodeId          int     `json:"nodeId"`
	ChannelPoint    string  `json:"channelPoint"`
	Force           *bool   `json:"force"`
	TargetConf      *int32  `json:"targetConf"`
	DeliveryAddress *string `json:"deliveryAddress"`
	SatPerVbyte     *uint64 `json:"satPerVbyte"`
}

type CloseChannelResponse added in v0.7.3

type CloseChannelResponse struct {
	ReqId        string             `json:"reqId"`
	Status       string             `json:"status"`
	ClosePending pendingUpdate      `json:"closePending"`
	ChanClose    channelCloseUpdate `json:"chanClose"`
}

type OpenChannelRequest added in v0.7.3

type OpenChannelRequest struct {
	NodeId             int     `json:"nodeId"`
	SatPerVbyte        *uint64 `json:"satPerVbyte"`
	NodePubKey         string  `json:"nodePubKey"`
	Host               *string `json:"host"`
	LocalFundingAmount int64   `json:"localFundingAmount"`
	PushSat            *int64  `json:"pushSat"`
	TargetConf         *int32  `json:"targetConf"`
	Private            *bool   `json:"private"`
	MinHtlcMsat        *int64  `json:"minHtlcMsat"`
	RemoteCsvDelay     *uint32 `json:"remoteCsvDelay"`
	MinConfs           *int32  `json:"minConfs"`
	SpendUnconfirmed   *bool   `json:"spendUnconfirmed"`
	CloseAddress       *string `json:"closeAddress"`
}

type OpenChannelResponse added in v0.7.3

type OpenChannelResponse struct {
	ReqId               string `json:"reqId"`
	Status              string `json:"status"`
	ChannelPoint        string `json:"channelPoint,omitempty"`
	PendingChannelPoint string `json:"pendingChannelPoint,omitempty"`
}

type OutPoint added in v0.9.0

type OutPoint struct {
	Txid        string `json:"txId"`
	OutputIndex uint32 `json:"outputIndex"`
}

type PendingHtlcs added in v0.9.0

type PendingHtlcs struct {
	ForwardingCount  int   `json:"forwardingCount"`
	ForwardingAmount int64 `json:"forwardingAmount"`
	LocalCount       int   `json:"localCount"`
	LocalAmount      int64 `json:"localAmount"`
	TotalCount       int   `json:"toalCount"`
	TotalAmount      int64 `json:"totalAmount"`
}

type PsbtDetails added in v0.7.3

type PsbtDetails struct {
	FundingAddress string `json:"funding_address,omitempty"`
	FundingAmount  int64  `json:"funding_amount,omitempty"`
	Psbt           []byte `json:"psbt,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL