commons

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LndService = ServiceType(iota)
	VectorService
	AmbossService
	TorqService
)
View Source
const (
	Boot = ServiceCommand(iota)
	// Kill requires Out return channel
	// status: Active => Service kill initiated
	// status: Pending => Service is booting and cannot be killed
	// status: Inactive => Service was not running and could not be killed
	Kill
)
View Source
const (
	Inactive = Status(iota)
	Active
	Pending
	Deleted
	Initializing
)
View Source
const (
	LND = Implementation(iota)
	CLN
)
View Source
const (
	Bitcoin = Chain(iota)
	Litecoin
)
View Source
const (
	MainNet = Network(iota)
	SigNet
	SimNet
	RegTest
	TestNet
)
View Source
const (
	Opening = ChannelStatus(iota)
	Open
	Closing
	CooperativeClosed      = 100
	LocalForceClosed       = 101
	RemoteForceClosed      = 102
	BreachClosed           = 103
	FundingCancelledClosed = 104
	AbandonedClosed        = 105
)
View Source
const (
	TransactionStream = SubscriptionStream(iota)
	HtlcEventStream
	ChannelEventStream
	GraphEventStream
	ForwardStream
	InvoiceStream
	PaymentStream
	InFlightPaymentStream
	PeerEventStream
	ChannelBalanceCacheStream
)
View Source
const (
	ImportChannelAndRoutingPolicies = ImportType(iota)
	ImportNodeInformation
)
View Source
const AMBOSS_SLEEP_SECONDS = 25
View Source
const AVOID_CHANNEL_AND_POLICY_IMPORT_RERUN_TIME_SECONDS = 70

70 because a reconnection is attempted every 60 seconds

View Source
const BOOTSTRAPPING_TIME_MINUTES = 8 * 60
View Source
const CHANNELBALANCE_BOOTSTRAP_TICKER_SECONDS = 10
View Source
const CHANNELBALANCE_TICKER_SECONDS = 150
View Source
const GENERIC_BOOTSTRAPPING_TIME_SECONDS = 60
View Source
const INVOICE_BOOTSTRAPPING_TIME_SECONDS = 60
View Source
const NodeConnectionDetailCustomSettingsMax = int(ImportFailedPayments)*2 - 1
View Source
const PingSystemMax = int(Vector)*2 - 1
View Source
const SERVICES_ERROR_SLEEP_SECONDS = 60
View Source
const STREAM_BOOTED_CHECK_SECONDS = 5
View Source
const STREAM_ERROR_SLEEP_SECONDS = 60
View Source
const STREAM_FORWARDS_TICKER_SECONDS = 10
View Source
const STREAM_INFLIGHT_PAYMENTS_TICKER_SECONDS = 60
View Source
const STREAM_LND_INVOICES_DELTA_TIME_MILLISECONDS = 1000
View Source
const STREAM_LND_INVOICES_INTERVAL_SLEEP = 10
View Source
const STREAM_LND_INVOICES_SLEEP_MILLISECONDS = 1000
View Source
const STREAM_PAYMENTS_TICKER_SECONDS = 10
View Source
const TOLERATED_SUBSCRIPTION_DOWNTIME_SECONDS = 15
View Source
const TorqDummyNodeId = -1337
View Source
const VECTOR_SLEEP_SECONDS = 20

Variables

View Source
var ManagedChannelChannel = make(chan ManagedChannel) //nolint:gochecknoglobals
View Source
var ManagedChannelGroupChannel = make(chan ManagedChannelGroup) //nolint:gochecknoglobals
View Source
var ManagedChannelStateChannel = make(chan ManagedChannelState) //nolint:gochecknoglobals
View Source
var ManagedNodeChannel = make(chan ManagedNode) //nolint:gochecknoglobals
View Source
var ManagedSettingsChannel = make(chan ManagedSettings) //nolint:gochecknoglobals
View Source
var RunningServices map[ServiceType]*Services //nolint:gochecknoglobals

Functions

func ConvertLNDShortChannelID added in v0.14.0

func ConvertLNDShortChannelID(LNDShortChannelID uint64) string

func ConvertShortChannelIDToLND added in v0.14.0

func ConvertShortChannelIDToLND(ShortChannelID string) (uint64, error)

func CreateChannelPoint added in v0.14.0

func CreateChannelPoint(fundingTransactionHash string, fundingOutputIndex int) string

func GetActiveChannelIdByFundingTransaction added in v0.13.0

func GetActiveChannelIdByFundingTransaction(fundingTransactionHash string, fundingOutputIndex int) int

func GetActiveChannelIdByShortChannelId added in v0.13.0

func GetActiveChannelIdByShortChannelId(shortChannelId string) int

func GetActiveNodeIdByPublicKey added in v0.13.0

func GetActiveNodeIdByPublicKey(publicKey string, chain Chain, network Network) int

func GetAllActiveTorqNodeIds added in v0.13.0

func GetAllActiveTorqNodeIds(chain *Chain, network *Network) []int

func GetAllChannelPublicKeys

func GetAllChannelPublicKeys(chain Chain, network Network) []string

func GetAllTorqNodeIds

func GetAllTorqNodeIds(chain Chain, network Network) []int

func GetAllTorqPublicKeys

func GetAllTorqPublicKeys(chain Chain, network Network) []string

func GetChannelIdByChannelPoint added in v0.14.0

func GetChannelIdByChannelPoint(channelPoint string) int

func GetChannelIdByFundingTransaction added in v0.13.0

func GetChannelIdByFundingTransaction(fundingTransactionHash string, fundingOutputIndex int) int

func GetChannelIdByLndShortChannelId added in v0.14.0

func GetChannelIdByLndShortChannelId(lndShortChannelId uint64) int

func GetChannelIdByShortChannelId added in v0.13.0

func GetChannelIdByShortChannelId(shortChannelId string) int

func GetChannelIdsByNodeId added in v0.14.0

func GetChannelIdsByNodeId(peerNodeId int) []int

func GetChannelNodeIds

func GetChannelNodeIds(chain Chain, network Network) []int

func GetChannelPublicKeys

func GetChannelPublicKeys(chain Chain, network Network) []string

func GetNodeIdByPublicKey added in v0.13.0

func GetNodeIdByPublicKey(publicKey string, chain Chain, network Network) int

func InactivateChannelNode

func InactivateChannelNode(publicKey string, chain Chain, network Network)

func ManagedChannelCache

func ManagedChannelCache(ch chan ManagedChannel, ctx context.Context)

func ManagedChannelGroupCache added in v0.12.0

func ManagedChannelGroupCache(ch chan ManagedChannelGroup, ctx context.Context)

func ManagedChannelStateCache added in v0.14.0

func ManagedChannelStateCache(ch chan ManagedChannelState, broadcaster broadcast.BroadcastServer, ctx context.Context)

ManagedChannelStateCache parameter Context is for test cases...

func ManagedNodeCache

func ManagedNodeCache(ch chan ManagedNode, ctx context.Context)

ManagedNodeCache parameter Context is for test cases...

func ManagedSettingsCache

func ManagedSettingsCache(ch chan ManagedSettings, ctx context.Context)

func MutexLocked added in v0.11.0

func MutexLocked(m *sync.Mutex) bool

func ParseChannelPoint added in v0.14.0

func ParseChannelPoint(channelPoint string) (string, int)

func RWMutexReadLocked added in v0.13.0

func RWMutexReadLocked(rw *sync.RWMutex) bool

func RWMutexWriteLocked added in v0.13.0

func RWMutexWriteLocked(rw *sync.RWMutex) bool

func SendToManagedChannelBalanceStateSettingsChannel added in v0.14.0

func SendToManagedChannelBalanceStateSettingsChannel(ch chan *ManagedChannelBalanceStateSettings, managedChannelBalanceStateSettings *ManagedChannelBalanceStateSettings)

func SendToManagedChannelBalanceStatesSettingsChannel added in v0.14.0

func SendToManagedChannelBalanceStatesSettingsChannel(ch chan []ManagedChannelBalanceStateSettings, managedChannelBalanceStateSettings []ManagedChannelBalanceStateSettings)

func SendToManagedChannelChannel

func SendToManagedChannelChannel(ch chan ManagedChannel, managedChannel ManagedChannel)

func SendToManagedChannelGroupSettingsChannel added in v0.12.0

func SendToManagedChannelGroupSettingsChannel(ch chan *ManagedChannelGroupSettings, managedChannelGroupSettings *ManagedChannelGroupSettings)

func SendToManagedChannelIdsChannel added in v0.14.0

func SendToManagedChannelIdsChannel(ch chan []int, channelIds []int)

func SendToManagedChannelSettingChannel added in v0.13.0

func SendToManagedChannelSettingChannel(ch chan ManagedChannelSettings, channelSettings ManagedChannelSettings)

func SendToManagedChannelSettingsChannel

func SendToManagedChannelSettingsChannel(ch chan []ManagedChannelSettings, channelSettings []ManagedChannelSettings)

func SendToManagedChannelStateSettingsChannel added in v0.14.0

func SendToManagedChannelStateSettingsChannel(ch chan *ManagedChannelStateSettings, managedChannelStateSettings *ManagedChannelStateSettings)

func SendToManagedChannelStatesSettingsChannel added in v0.14.0

func SendToManagedChannelStatesSettingsChannel(ch chan []ManagedChannelStateSettings, managedChannelBalanceStateSettings []ManagedChannelStateSettings)

func SendToManagedNodeChannel

func SendToManagedNodeChannel(ch chan ManagedNode, managedNode ManagedNode)

func SendToManagedNodeIdsChannel

func SendToManagedNodeIdsChannel(ch chan []int, nodeIds []int)

func SendToManagedNodeSettingsChannel

func SendToManagedNodeSettingsChannel(ch chan ManagedNodeSettings, nodeSettings ManagedNodeSettings)

func SendToManagedPublicKeysChannel

func SendToManagedPublicKeysChannel(ch chan []string, publicKeys []string)

func SendToManagedSettingsChannel

func SendToManagedSettingsChannel(ch chan ManagedSettings, managedSettings ManagedSettings)

func SetChannel

func SetChannel(channelId int, shortChannelId *string, status ChannelStatus,
	fundingTransactionHash string, fundingOutputIndex int, capacity int64, private bool, firstNodeId, secondNodeId int,
	initiatingNodeId, acceptingNodeId *int)

func SetChannelGroupsByChannelId added in v0.12.0

func SetChannelGroupsByChannelId(channelId int, channelGroups []ChannelGroup)

func SetChannelNode

func SetChannelNode(nodeId int, publicKey string, chain Chain, network Network, status ChannelStatus)

func SetChannelStateBalanceHtlcEvent added in v0.14.0

func SetChannelStateBalanceHtlcEvent(htlcEvent HtlcEvent)

func SetChannelStateBalanceUpdate added in v0.14.0

func SetChannelStateBalanceUpdate(nodeId int, channelId int, increaseBalance bool, amount int64)

func SetChannelStateBalanceUpdateMsat added in v0.14.0

func SetChannelStateBalanceUpdateMsat(nodeId int, channelId int, increaseBalance bool, amount uint64)

func SetChannelStateChannelStatus added in v0.14.0

func SetChannelStateChannelStatus(nodeId int, channelId int, status Status)

func SetChannelStateNodeStatus added in v0.14.0

func SetChannelStateNodeStatus(nodeId int, status Status)

func SetChannelStateRoutingPolicy added in v0.14.0

func SetChannelStateRoutingPolicy(nodeId int, channelId int, local bool,
	disabled bool, timeLockDelta uint32, minHtlc int64, maxHtlcMsat uint64, feeBaseMsat uint64, feeRateMilliMsat uint64)

func SetChannelStates added in v0.14.0

func SetChannelStates(nodeId int, channelStateSettings []ManagedChannelStateSettings)

func SetChannelStatus

func SetChannelStatus(channelId int, status ChannelStatus)

func SetInactiveChannelNode

func SetInactiveChannelNode(nodeId int, publicKey string, chain Chain, network Network)

func SetSettings

func SetSettings(defaultDateRange, defaultLanguage, weekStartsOn, preferredTimeZone string)

func SetTorqNode

func SetTorqNode(nodeId int, name string, status Status, publicKey string, chain Chain, network Network)

SetTorqNode When active then also adds to channelNodes

Types

type BlockEvent added in v0.13.0

type BlockEvent struct {
	EventData
	Height uint32 `json:"height"`
	Hash   []byte `json:"hash"`
}

type Chain

type Chain int

func GetChain

func GetChain(chain string) Chain

GetChain defaults to Bitcoin when no match is found

type ChannelBalanceStateHtlcInclude added in v0.14.0

type ChannelBalanceStateHtlcInclude uint
const (
	PENDING_HTLCS_IGNORED ChannelBalanceStateHtlcInclude = iota
	// PENDING_HTLCS_LOCAL_BALANCE_ADJUSTED_DOWNWARDS:
	//   LocalBalance = ConfirmedLocalBalance - PendingDecreasingForwardHTLCsAmount - PendingPaymentHTLCsAmount
	PENDING_HTLCS_LOCAL_BALANCE_ADJUSTED_DOWNWARDS
	// PENDING_HTLCS_REMOTE_BALANCE_ADJUSTED_DOWNWARDS:
	//   RemoteBalance = ConfirmedRemoteBalance - PendingIncreasingForwardHTLCsAmount - PendingInvoiceHTLCsAmount
	PENDING_HTLCS_REMOTE_BALANCE_ADJUSTED_DOWNWARDS
	// PENDING_HTLCS_LOCAL_AND_REMOTE_BALANCE_ADJUSTED_DOWNWARDS:
	//   LocalBalance = ConfirmedLocalBalance - PendingDecreasingForwardHTLCsAmount - PendingPaymentHTLCsAmount
	//   RemoteBalance = ConfirmedRemoteBalance - PendingIncreasingForwardHTLCsAmount - PendingInvoiceHTLCsAmount
	PENDING_HTLCS_LOCAL_AND_REMOTE_BALANCE_ADJUSTED_DOWNWARDS
	// PENDING_HTLCS_LOCAL_BALANCE_ADJUSTED_UPWARDS:
	//   LocalBalance = ConfirmedLocalBalance + PendingIncreasingForwardHTLCsAmount + PendingInvoiceHTLCsAmount
	PENDING_HTLCS_LOCAL_BALANCE_ADJUSTED_UPWARDS
	//   RemoteBalance = ConfirmedRemoteBalance + PendingDecreasingForwardHTLCsAmount + PendingPaymentHTLCsAmount
	PENDING_HTLCS_REMOTE_BALANCE_ADJUSTED_UPWARDS
	// PENDING_HTLCS_LOCAL_AND_REMOTE_BALANCE_ADJUSTED_UPWARDS:
	//   LocalBalance = ConfirmedLocalBalance + PendingIncreasingForwardHTLCsAmount + PendingInvoiceHTLCsAmount
	//   RemoteBalance = ConfirmedRemoteBalance + PendingDecreasingForwardHTLCsAmount + PendingPaymentHTLCsAmount
	PENDING_HTLCS_LOCAL_AND_REMOTE_BALANCE_ADJUSTED_UPWARDS
)

type ChannelEvent added in v0.13.0

type ChannelEvent struct {
	EventData
	Type      lnrpc.ChannelEventUpdate_UpdateType `json:"type"`
	ChannelId int                                 `json:"channelId"`
}

type ChannelGraphEvent added in v0.13.0

type ChannelGraphEvent struct {
	GraphEventData
	ChannelGraphEventData
	PreviousEventTime time.Time             `json:"previousEventTime"`
	PreviousEventData ChannelGraphEventData `json:"previous"`
}

type ChannelGraphEventData added in v0.13.0

type ChannelGraphEventData struct {
	Disabled         bool   `json:"disabled"`
	TimeLockDelta    uint32 `json:"timeLockDelta"`
	MinHtlc          int64  `json:"minHtlc"`
	MaxHtlcMsat      uint64 `json:"maxHtlcMsat"`
	FeeBaseMsat      uint64 `json:"feeBaseMsat"`
	FeeRateMilliMsat uint64 `json:"feeRateMilliMsat"`
}

type ChannelGroup added in v0.12.0

type ChannelGroup struct {
	TagId         *int    `json:"tagId" db:"tag_id"`
	TagName       *string `json:"tagName" db:"tag_name"`
	TagStyle      *string `json:"tagStyle" db:"tag_style"`
	CategoryId    *int    `json:"categoryId" db:"category_id"`
	CategoryName  *string `json:"categoryName" db:"category_name"`
	CategoryStyle *string `json:"categoryStyle" db:"category_style"`
}

type ChannelGroupInclude added in v0.12.0

type ChannelGroupInclude uint
const (
	CATEGORIES_ONLY ChannelGroupInclude = iota
	DISTINCT_REGULAR_AND_TAG_CATEGORIES
	ALL_REGULAR_AND_TAG_CATEGORIES
	TAGS_ONLY
)

type ChannelStateInclude added in v0.14.0

type ChannelStateInclude uint
const (
	ALL_LOCAL_ACTIVE_CHANNELS ChannelStateInclude = iota
	ALL_LOCAL_AND_REMOTE_ACTIVE_CHANNELS
	ALL_CHANNELS
)

type ChannelStatus

type ChannelStatus int

func GetChannelStatusByChannelId added in v0.13.0

func GetChannelStatusByChannelId(channelId int) ChannelStatus

type EventData added in v0.13.0

type EventData struct {
	EventTime time.Time `json:"eventTime"`
	NodeId    int       `json:"nodeId"`
}

type ForwardEvent added in v0.13.0

type ForwardEvent struct {
	EventData
	Timestamp         time.Time `json:"timestamp"`
	FeeMsat           uint64    `json:"feeMsat"`
	AmountInMsat      uint64    `json:"amountInMsat"`
	AmountOutMsat     uint64    `json:"amountOutMsat"`
	OutgoingChannelId *int      `json:"outgoingChannelId"`
	IncomingChannelId *int      `json:"incomingChannelId"`
}

type GraphEventData added in v0.13.0

type GraphEventData struct {
	EventData
	EventNodeId      *int `json:"eventNodeId"`
	AnnouncingNodeId *int `json:"announcingNodeId"`
	ConnectingNodeId *int `json:"connectingNodeId"`
	ChannelId        *int `json:"channelId"`
}

type Htlc added in v0.14.0

type Htlc struct {
	Incoming         bool
	Amount           int64
	HashLock         []byte
	ExpirationHeight uint32
	// Index identifying the htlc on the channel.
	HtlcIndex uint64
	// If this HTLC is involved in a forwarding operation, this field indicates
	// the forwarding channel. For an outgoing htlc, it is the incoming channel.
	// For an incoming htlc, it is the outgoing channel. When the htlc
	// originates from this node or this node is the final destination,
	// forwarding_channel will be zero. The forwarding channel will also be zero
	// for htlcs that need to be forwarded but don't have a forwarding decision
	// persisted yet.
	ForwardingChannel uint64
	// Index identifying the htlc on the forwarding channel.
	ForwardingHtlcIndex uint64
}

type HtlcEvent added in v0.13.0

type HtlcEvent struct {
	EventData
	Timestamp         time.Time `json:"timestamp"`
	Data              string    `json:"data"`
	EventOrigin       *string   `json:"eventOrigin"`
	EventType         *string   `json:"eventType"`
	OutgoingHtlcId    *uint64   `json:"outgoingHtlcId"`
	IncomingHtlcId    *uint64   `json:"incomingHtlcId"`
	TimestampNs       *uint64   `json:"timestampNs"`
	IncomingAmtMsat   *uint64   `json:"incomingAmtMsat"`
	OutgoingAmtMsat   *uint64   `json:"outgoingAmtMsat"`
	IncomingTimelock  *uint32   `json:"incomingTimelock"`
	OutgoingTimelock  *uint32   `json:"outgoingTimelock"`
	BoltFailureCode   *string   `json:"boltFailureCode"`
	BoltFailureString *string   `json:"boltFailureString"`
	LndFailureDetail  *string   `json:"lndFailureDetail"`
	OutgoingChannelId *int      `json:"outgoingChannelId"`
	IncomingChannelId *int      `json:"incomingChannelId"`
}

type Implementation

type Implementation int

type ImportRequest added in v0.13.0

type ImportRequest struct {
	ImportType ImportType
	Out        chan error
}

type ImportType added in v0.13.0

type ImportType int

type InvoiceEvent added in v0.13.0

type InvoiceEvent struct {
	EventData
	ChannelId      int                        `json:"channelId"`
	AddIndex       uint64                     `json:"addIndex"`
	ValueMSat      uint64                     `json:"valueMSat"`
	State          lnrpc.Invoice_InvoiceState `json:"state"`
	AmountPaidMsat uint64                     `json:"amountPaidMsat"`
	SettledDate    time.Time                  `json:"settledDate"`
}

type ManagedChannel

type ManagedChannel struct {
	Type                   ManagedChannelCacheOperationType
	ChannelId              int
	ShortChannelId         string
	LndShortChannelId      uint64
	FundingTransactionHash string
	FundingOutputIndex     int
	Capacity               int64
	NodeId                 int
	FirstNodeId            int
	SecondNodeId           int
	InitiatingNodeId       *int
	AcceptingNodeId        *int
	Private                bool
	Status                 ChannelStatus
	Out                    chan ManagedChannel
	ChannelSettingOut      chan ManagedChannelSettings
	ChannelSettingsOut     chan []ManagedChannelSettings
	ChannelIdsOut          chan []int
}

type ManagedChannelBalanceStateSettings added in v0.14.0

type ManagedChannelBalanceStateSettings struct {
	NodeId                     int                            `json:"nodeId"`
	RemoteNodeId               int                            `json:"remoteNodeId"`
	ChannelId                  int                            `json:"channelId"`
	HtlcInclude                ChannelBalanceStateHtlcInclude `json:"htlcInclude"`
	LocalBalance               int64                          `json:"localBalance"`
	LocalBalancePerMilleRatio  int                            `json:"localBalancePerMilleRatio"`
	RemoteBalance              int64                          `json:"remoteBalance"`
	RemoteBalancePerMilleRatio int                            `json:"remoteBalancePerMilleRatio"`
}

func GetChannelBalanceState added in v0.14.0

func GetChannelBalanceState(nodeId, channelId int, htlcInclude ChannelBalanceStateHtlcInclude) *ManagedChannelBalanceStateSettings

func GetChannelBalanceStates added in v0.14.0

func GetChannelBalanceStates(nodeId int, channelStateInclude ChannelStateInclude, htlcInclude ChannelBalanceStateHtlcInclude) []ManagedChannelBalanceStateSettings

type ManagedChannelCacheOperationType

type ManagedChannelCacheOperationType uint
const (
	// READ_ACTIVE_CHANNELID_BY_SHORTCHANNELID please provide ShortChannelId and Out
	READ_ACTIVE_CHANNELID_BY_SHORTCHANNELID ManagedChannelCacheOperationType = iota
	// READ_CHANNELID_BY_SHORTCHANNELID please provide ShortChannelId and Out
	READ_CHANNELID_BY_SHORTCHANNELID
	// READ_ACTIVE_CHANNELID_BY_FUNDING_TRANSACTION please provide FundingTransactionHash, FundingOutputIndex and Out
	READ_ACTIVE_CHANNELID_BY_FUNDING_TRANSACTION
	// READ_CHANNELID_BY_FUNDING_TRANSACTION please provide FundingTransactionHash, FundingOutputIndex and Out
	READ_CHANNELID_BY_FUNDING_TRANSACTION
	// READ_CHANNELIDS_BY_NODE_ID please provide NodeId and ChannelIdsOut
	READ_CHANNELIDS_BY_NODE_ID
	// READ_STATUSID_BY_CHANNELID please provide ChannelId and Out
	READ_STATUSID_BY_CHANNELID
	// READ_CHANNEL_SETTINGS please provide ChannelId and ChannelSettingOut
	READ_CHANNEL_SETTINGS
	// READ_ALL_CHANNEL_SETTINGS please provide FirstNodeId and ChannelSettingsOut
	READ_ALL_CHANNEL_SETTINGS
	// WRITE_CHANNEL Please provide ChannelId, FundingTransactionHash, FundingOutputIndex and Status (other values are optional in case of pending open channel)
	WRITE_CHANNEL
	// WRITE_CHANNELSTATUSID Please provide ChannelId and Status
	WRITE_CHANNELSTATUSID
)

type ManagedChannelGroup added in v0.12.0

type ManagedChannelGroup struct {
	Type          ManagedChannelGroupCacheOperationType
	ChannelId     int
	Include       ChannelGroupInclude
	ChannelGroups []ChannelGroup
	Out           chan *ManagedChannelGroupSettings
}

type ManagedChannelGroupCacheOperationType added in v0.12.0

type ManagedChannelGroupCacheOperationType uint
const (
	// READ_CHANNELGROUPS please provide ChannelId and Out
	READ_CHANNELGROUPS ManagedChannelGroupCacheOperationType = iota
	// WRITE_CHANNELGROUPS Please provide ChannelId, ChannelGroups
	WRITE_CHANNELGROUPS
)

type ManagedChannelGroupSettings added in v0.12.0

type ManagedChannelGroupSettings struct {
	ChannelId     int
	ChannelGroups []ChannelGroup
}

func GetChannelGroupsByChannelId added in v0.12.0

func GetChannelGroupsByChannelId(channelId int, include ChannelGroupInclude) *ManagedChannelGroupSettings

type ManagedChannelSettings

type ManagedChannelSettings struct {
	ChannelId              int
	ShortChannelId         string
	LndShortChannelId      uint64
	FundingTransactionHash string
	FundingOutputIndex     int
	Capacity               int64
	FirstNodeId            int
	SecondNodeId           int
	InitiatingNodeId       *int
	AcceptingNodeId        *int
	Private                bool
	Status                 ChannelStatus
}

func GetChannelSettingByChannelId added in v0.13.0

func GetChannelSettingByChannelId(channelId int) ManagedChannelSettings

func GetChannelSettingsByNodeId added in v0.13.0

func GetChannelSettingsByNodeId(nodeId int) []ManagedChannelSettings

type ManagedChannelState added in v0.14.0

type ManagedChannelState struct {
	Type                 ManagedChannelStateCacheOperationType
	NodeId               int
	RemoteNodeId         int
	ChannelId            int
	Status               Status
	Local                bool
	Balance              int64
	Disabled             bool
	FeeBaseMsat          uint64
	FeeRateMilliMsat     uint64
	MinHtlc              int64
	MaxHtlcMsat          uint64
	TimeLockDelta        uint32
	Amount               int64
	ForceResponse        bool
	HtlcEvent            HtlcEvent
	ChannelStateSettings []ManagedChannelStateSettings
	HtlcInclude          ChannelBalanceStateHtlcInclude
	StateInclude         ChannelStateInclude
	StateOut             chan *ManagedChannelStateSettings
	StatesOut            chan []ManagedChannelStateSettings
	BalanceStateOut      chan *ManagedChannelBalanceStateSettings
	BalanceStatesOut     chan []ManagedChannelBalanceStateSettings
}

type ManagedChannelStateCacheOperationType added in v0.14.0

type ManagedChannelStateCacheOperationType uint
const (
	// READ_CHANNELSTATE please provide NodeId, ChannelId and StateOut
	READ_CHANNELSTATE ManagedChannelStateCacheOperationType = iota
	// READ_ALL_CHANNELSTATES please provide NodeId and StatesOut
	READ_ALL_CHANNELSTATES
	// READ_CHANNELBALANCESTATE please provide NodeId, ChannelId, HtlcInclude and BalanceStateOut
	READ_CHANNELBALANCESTATE
	// READ_ALL_CHANNELBALANCESTATES please provide NodeId, StateInclude, HtlcInclude and BalanceStatesOut
	READ_ALL_CHANNELBALANCESTATES
	// WRITE_INITIAL_CHANNELSTATES This requires the lock being active for writing! Please provide the complete information set
	WRITE_INITIAL_CHANNELSTATES
	WRITE_CHANNELSTATE_NODESTATUS
	WRITE_CHANNELSTATE_CHANNELSTATUS
	WRITE_CHANNELSTATE_ROUTINGPOLICY
	WRITE_CHANNELSTATE_UPDATEBALANCE
	WRITE_CHANNELSTATE_UPDATEHTLCEVENT
)

type ManagedChannelStateSettings added in v0.14.0

type ManagedChannelStateSettings struct {
	NodeId       int `json:"nodeId"`
	RemoteNodeId int `json:"remoteNodeId"`
	ChannelId    int `json:"channelId"`

	LocalBalance          int64  `json:"localBalance"`
	LocalDisabled         bool   `json:"localDisabled"`
	LocalFeeBaseMsat      uint64 `json:"localFeeBaseMsat"`
	LocalFeeRateMilliMsat uint64 `json:"localFeeRateMilliMsat"`
	LocalMinHtlc          int64  `json:"localMinHtlc"`
	LocalMaxHtlcMsat      uint64 `json:"localMaxHtlcMsat"`
	LocalTimeLockDelta    uint32 `json:"localTimeLockDelta"`

	RemoteBalance          int64  `json:"remoteBalance"`
	RemoteDisabled         bool   `json:"remoteDisabled"`
	RemoteFeeBaseMsat      uint64 `json:"remoteFeeBaseMsat"`
	RemoteFeeRateMilliMsat uint64 `json:"remoteFeeRateMilliMsat"`
	RemoteMinHtlc          int64  `json:"remoteMinHtlc"`
	RemoteMaxHtlcMsat      uint64 `json:"remoteMaxHtlcMsat"`
	RemoteTimeLockDelta    uint32 `json:"remoteTimeLockDelta"`

	UnsettledBalance int64 `json:"unsettledBalance"`

	PendingHtlcs []Htlc `json:"pendingHtlcs"`
	// INCREASING LOCAL BALANCE HTLCs
	PendingIncomingHtlcCount  int   `json:"pendingIncomingHtlcCount"`
	PendingIncomingHtlcAmount int64 `json:"pendingIncomingHtlcAmount"`
	// DECREASING LOCAL BALANCE HTLCs
	PendingOutgoingHtlcCount  int   `json:"pendingOutgoingHtlcCount"`
	PendingOutgoingHtlcAmount int64 `json:"pendingOutgoingHtlcAmount"`

	// STALE INFORMATION ONLY OBTAINED VIA LND REGULAR CHECKINS SO NOT MAINTAINED
	CommitFee             int64                `json:"commitFee"`
	CommitWeight          int64                `json:"commitWeight"`
	FeePerKw              int64                `json:"feePerKw"`
	NumUpdates            uint64               `json:"numUpdates"`
	ChanStatusFlags       string               `json:"chanStatusFlags"`
	CommitmentType        lnrpc.CommitmentType `json:"commitmentType"`
	Lifetime              int64                `json:"lifetime"`
	TotalSatoshisReceived int64                `json:"totalSatoshisReceived"`
	TotalSatoshisSent     int64                `json:"totalSatoshisSent"`
}

func GetChannelState added in v0.14.0

func GetChannelState(nodeId, channelId int) *ManagedChannelStateSettings

func GetChannelStates added in v0.14.0

func GetChannelStates(nodeId int, forceResponse bool) []ManagedChannelStateSettings

type ManagedNode

type ManagedNode struct {
	Type              ManagedNodeCacheOperationType
	NodeId            int
	Chain             *Chain
	Network           *Network
	PublicKey         string
	Name              *string
	Out               chan ManagedNode
	NodeIdsOut        chan []int
	NodeIdSettingsOut chan ManagedNodeSettings
	PublicKeysOut     chan []string
}

type ManagedNodeCacheOperationType

type ManagedNodeCacheOperationType uint
const (
	READ_ALL_TORQ_NODE ManagedNodeCacheOperationType = iota
	WRITE_INACTIVE_TORQ_NODE
	READ_ALL_TORQ_NODEIDS
	READ_ALL_TORQ_PUBLICKEYS
	READ_ACTIVE_TORQ_NODE
	WRITE_ACTIVE_TORQ_NODE
	READ_ACTIVE_TORQ_NODEIDS
	READ_ACTIVE_TORQ_PUBLICKEYS
	READ_ALL_ACTIVE_TORQ_NODEIDS
	READ_ACTIVE_CHANNEL_NODE
	READ_CHANNEL_NODE
	WRITE_ACTIVE_CHANNEL_NODE
	WRITE_INACTIVE_CHANNEL_NODE
	INACTIVATE_CHANNEL_NODE
	READ_ALL_CHANNEL_NODEIDS
	READ_ALL_CHANNEL_PUBLICKEYS
	READ_NODE_SETTINGS
)

type ManagedNodeSettings

type ManagedNodeSettings struct {
	NodeId    int
	Chain     Chain
	Network   Network
	PublicKey string
	Name      *string
	Status    Status
}

func GetNodeSettingsByNodeId

func GetNodeSettingsByNodeId(nodeId int) ManagedNodeSettings

type ManagedSettings

type ManagedSettings struct {
	Type              ManagedSettingsCacheOperationType
	DefaultLanguage   string
	PreferredTimeZone string
	DefaultDateRange  string
	WeekStartsOn      string
	Out               chan ManagedSettings
}

func GetSettings

func GetSettings() ManagedSettings

type ManagedSettingsCacheOperationType

type ManagedSettingsCacheOperationType uint
const (
	// READ_SETTINGS please provide Out
	READ_SETTINGS ManagedSettingsCacheOperationType = iota
	// WRITE_SETTINGS please provide defaultLanguage, preferredTimeZone, defaultDateRange and weekStartsOn
	WRITE_SETTINGS
)

type Network

type Network int

func GetNetwork

func GetNetwork(network string) Network

GetNetwork defaults to MainNet when no match is found

type NodeConnectionDetailCustomSettings added in v0.13.0

type NodeConnectionDetailCustomSettings byte
const (
	ImportFailedPayments NodeConnectionDetailCustomSettings = 1 << iota
)

type NodeGraphEvent added in v0.13.0

type NodeGraphEvent struct {
	GraphEventData
	NodeGraphEventData
	PreviousEventTime time.Time          `json:"previousEventTime"`
	PreviousEventData NodeGraphEventData `json:"previous"`
}

type NodeGraphEventData added in v0.13.0

type NodeGraphEventData struct {
	Alias     string `json:"alias"`
	Color     string `json:"color"`
	Addresses string `json:"addresses"`
	Features  string `json:"features"`
}

type PaymentEvent added in v0.14.0

type PaymentEvent struct {
	EventData
	AmountPaid           int64                       `json:"amountPaid"`
	FeeMsat              uint64                      `json:"feeMsat"`
	PaymentStatus        lnrpc.Payment_PaymentStatus `json:"paymentStatus"`
	PaymentFailureReason lnrpc.PaymentFailureReason  `json:"paymentFailureReason"`
	OutgoingChannelId    *int                        `json:"outgoingChannelId"`
	RebalanceAmountMsat  *uint64                     `json:"rebalanceAmount"`
	IncomingChannelId    *int                        `json:"incomingChannelId"`
}

type PeerEvent added in v0.13.0

type PeerEvent struct {
	EventData
	Type        lnrpc.PeerEvent_EventType `json:"type"`
	EventNodeId int                       `json:"eventNodeId"`
}

type PingSystem added in v0.11.0

type PingSystem byte
const (
	Amboss PingSystem = 1 << iota
	Vector
)

type ServiceChannelMessage added in v0.11.0

type ServiceChannelMessage = struct {
	ServiceType    ServiceType
	ServiceCommand ServiceCommand
	NodeId         int
	// EnforcedServiceStatus is a one time status enforcement for a service
	EnforcedServiceStatus *Status
	// NoDelay is a one time no delay enforcement for a service
	NoDelay bool
	Out     chan Status
}

type ServiceCommand added in v0.11.0

type ServiceCommand int

type ServiceEvent added in v0.13.0

type ServiceEvent struct {
	EventData
	Type               ServiceType
	SubscriptionStream *SubscriptionStream
	Status             Status
	PreviousStatus     Status
}

type ServiceType added in v0.11.0

type ServiceType int

type Services added in v0.13.0

type Services struct {
	ServiceType ServiceType
	// contains filtered or unexported fields
}

func (*Services) AddSubscription added in v0.13.0

func (rs *Services) AddSubscription(nodeId int, cancelFunc func(), eventChannel chan interface{})

func (*Services) Booted added in v0.13.0

func (rs *Services) Booted(nodeId int, bootLock *sync.Mutex, eventChannel chan interface{})

func (*Services) Cancel added in v0.13.0

func (rs *Services) Cancel(nodeId int, enforcedServiceStatus *Status, noDelay bool, eventChannel chan interface{}) Status

func (*Services) GetActiveNodeIds added in v0.13.0

func (rs *Services) GetActiveNodeIds() []int

func (*Services) GetBootLock added in v0.13.0

func (rs *Services) GetBootLock(nodeId int) *sync.Mutex

func (*Services) GetBootTime added in v0.13.0

func (rs *Services) GetBootTime(nodeId int) *time.Time

GetBootTime When the service is active it will return it's boot time

func (*Services) GetChannelBalanceCacheStreamStatus added in v0.13.0

func (rs *Services) GetChannelBalanceCacheStreamStatus(nodeId int) Status

func (*Services) GetEnforcedServiceStatusCheck added in v0.13.0

func (rs *Services) GetEnforcedServiceStatusCheck(nodeId int) *Status

func (*Services) GetIncludeIncomplete added in v0.13.0

func (rs *Services) GetIncludeIncomplete(nodeId int) bool

func (*Services) GetNodeIds added in v0.13.0

func (rs *Services) GetNodeIds() []int

func (*Services) GetStatus added in v0.13.0

func (rs *Services) GetStatus(nodeId int) Status

GetStatus return the status of the Service but in case of ServiceType = LndSubscription then streamStatuses are also verified. If one of the streamStatuses is not active then this function return Pending

func (*Services) GetStreamBootTime added in v0.13.0

func (rs *Services) GetStreamBootTime(nodeId int, stream SubscriptionStream) *time.Time

GetStreamBootTime when the status of the LND Service is active and streamStatus is active then bootTime will have a value

func (*Services) GetStreamInitializationPingTime added in v0.13.0

func (rs *Services) GetStreamInitializationPingTime(nodeId int, stream SubscriptionStream) *time.Time

func (*Services) GetStreamStatus added in v0.13.0

func (rs *Services) GetStreamStatus(nodeId int, stream SubscriptionStream) Status

GetStreamStatus when the status of the LND Service is active then streamStatus will be returned.

func (*Services) Initialising added in v0.14.0

func (rs *Services) Initialising(nodeId int, eventChannel chan interface{})

func (*Services) IsNoDelay added in v0.13.0

func (rs *Services) IsNoDelay(nodeId int) bool

func (*Services) RemoveSubscription added in v0.13.0

func (rs *Services) RemoveSubscription(nodeId int, eventChannel chan interface{})

func (*Services) SetIncludeIncomplete added in v0.13.0

func (rs *Services) SetIncludeIncomplete(nodeId int, includeIncomplete bool)

func (*Services) SetStreamStatus added in v0.13.0

func (rs *Services) SetStreamStatus(nodeId int, stream SubscriptionStream, status Status, eventChannel chan interface{})

type Status

type Status int

type SubscriptionStream added in v0.13.0

type SubscriptionStream int

func (*SubscriptionStream) IsChannelBalanceCache added in v0.13.0

func (ss *SubscriptionStream) IsChannelBalanceCache() bool

type TransactionEvent added in v0.13.0

type TransactionEvent struct {
	EventData
	Timestamp             time.Time `json:"timestamp"`
	TransactionHash       *string   `json:"transactionHash"`
	Amount                *int64    `json:"amount"`
	NumberOfConfirmations *int32    `json:"numberOfConfirmations"`
	BlockHash             *string   `json:"blockHash"`
	BlockHeight           *int32    `json:"blockHeight"`
	TotalFees             *int64    `json:"totalFees"`
	DestinationAddresses  *[]string `json:"destinationAddresses"`
	RawTransactionHex     *string   `json:"rawTransactionHex"`
	Label                 *string   `json:"label"`
}

Jump to

Keyboard shortcuts

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