Documentation ¶
Index ¶
- func ChannelBalanceCacheMaintenance(ctx context.Context, lndClient lnrpc.LightningClient, db *sqlx.DB, ...)
- func ImportChannelList(t lnrpc.ChannelEventUpdate_UpdateType, db *sqlx.DB, ...) error
- func ImportNodeInfo(client subscribeChannelGraphClient, db *sqlx.DB, ...) error
- func ImportRoutingPolicies(client lndClientChannelEvent, db *sqlx.DB, ...) error
- func LightningCommunicationService(ctx context.Context, conn *grpc.ClientConn, db *sqlx.DB, nodeId int, ...)
- func SendStreamEvent(eventChannel chan interface{}, nodeId int, ...) commons.Status
- func SubscribeAndStoreChannelEvents(ctx context.Context, client lndClientSubscribeChannelEvent, db *sqlx.DB, ...)
- func SubscribeAndStoreChannelGraph(ctx context.Context, client subscribeChannelGraphClient, db *sqlx.DB, ...)
- func SubscribeAndStoreHtlcEvents(ctx context.Context, router routerrpc.RouterClient, db *sqlx.DB, ...)
- func SubscribeAndStoreInvoices(ctx context.Context, client invoicesClient, db *sqlx.DB, ...)
- func SubscribeAndStorePayments(ctx context.Context, client lightningClient_ListPayments, db *sqlx.DB, ...)
- func SubscribeAndStoreTransactions(ctx context.Context, client lnrpc.LightningClient, ...)
- func SubscribeForwardingEvents(ctx context.Context, client lightningClientForwardingHistory, db *sqlx.DB, ...)
- func SubscribePeerEvents(ctx context.Context, client peerEventsClient, ...)
- func UpdateInFlightPayments(ctx context.Context, client lightningClient_ListPayments, db *sqlx.DB, ...)
- type FwhOptions
- type HtlcEvent
- type Invoice
- type PayOptions
- type Payment
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChannelBalanceCacheMaintenance ¶ added in v0.14.0
func ChannelBalanceCacheMaintenance(ctx context.Context, lndClient lnrpc.LightningClient, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, broadcaster broadcast.BroadcastServer, eventChannel chan interface{})
func ImportChannelList ¶
func ImportChannelList(t lnrpc.ChannelEventUpdate_UpdateType, db *sqlx.DB, client lnrpc.LightningClient, nodeSettings commons.ManagedNodeSettings) error
func ImportNodeInfo ¶ added in v0.10.0
func ImportNodeInfo(client subscribeChannelGraphClient, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings) error
func ImportRoutingPolicies ¶
func ImportRoutingPolicies(client lndClientChannelEvent, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings) error
ImportRoutingPolicies imports routing policy information about all channels if they don't already have
func LightningCommunicationService ¶ added in v0.16.0
func LightningCommunicationService(ctx context.Context, conn *grpc.ClientConn, db *sqlx.DB, nodeId int, broadcaster broadcast.BroadcastServer)
func SendStreamEvent ¶ added in v0.13.0
func SubscribeAndStoreChannelEvents ¶
func SubscribeAndStoreChannelEvents(ctx context.Context, client lndClientSubscribeChannelEvent, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{}, importRequestChannel chan commons.ImportRequest)
SubscribeAndStoreChannelEvents Subscribes to channel events from LND and stores them in the database as a time series
func SubscribeAndStoreChannelGraph ¶
func SubscribeAndStoreChannelGraph(ctx context.Context, client subscribeChannelGraphClient, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{}, importRequestChannel chan commons.ImportRequest)
SubscribeAndStoreChannelGraph Subscribes to channel updates
func SubscribeAndStoreHtlcEvents ¶
func SubscribeAndStoreHtlcEvents(ctx context.Context, router routerrpc.RouterClient, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{})
SubscribeAndStoreHtlcEvents subscribes to HTLC events from LND and stores them in the database as time series. NB: LND has marked HTLC event streaming as experimental. Delivery is not guaranteed, so dataset might not be complete HTLC events is primarily used to diagnose how good a channel / node is. And if the channel allocation should change.
func SubscribeAndStoreInvoices ¶ added in v0.4.6
func SubscribeAndStorePayments ¶ added in v0.4.6
func SubscribeAndStorePayments(ctx context.Context, client lightningClient_ListPayments, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{}, opt *PayOptions)
func SubscribeAndStoreTransactions ¶
func SubscribeAndStoreTransactions(ctx context.Context, client lnrpc.LightningClient, chain chainrpc.ChainNotifierClient, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{})
SubscribeAndStoreTransactions Subscribes to on-chain transaction events from LND and stores them in the database as a time series. It will also import unregistered transactions on startup.
func SubscribeForwardingEvents ¶
func SubscribeForwardingEvents(ctx context.Context, client lightningClientForwardingHistory, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{}, opt *FwhOptions)
SubscribeForwardingEvents repeatedly requests forwarding history starting after the last forwarding stored in the database and stores new forwards.
func SubscribePeerEvents ¶ added in v0.8.20
func SubscribePeerEvents(ctx context.Context, client peerEventsClient, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{})
func UpdateInFlightPayments ¶ added in v0.8.19
func UpdateInFlightPayments(ctx context.Context, client lightningClient_ListPayments, db *sqlx.DB, nodeSettings commons.ManagedNodeSettings, eventChannel chan interface{}, opt *PayOptions)
Types ¶
type FwhOptions ¶
FwhOptions allows the caller to adjust the number of forwarding events can be requested at a time and set a custom time interval between requests.
type HtlcEvent ¶ added in v0.11.0
type HtlcEvent struct { Time time.Time `json:"time" db:"time"` Data string `json:"data" db:"data"` EventOrigin *string `json:"eventOrigin" db:"event_origin"` EventType *string `json:"eventType" db:"event_type"` OutgoingHtlcId *uint64 `json:"outgoingHtlcId" db:"outgoing_htlc_id"` IncomingHtlcId *uint64 `json:"incomingHtlcId" db:"incoming_htlc_id"` TimestampNs *uint64 `json:"timestampNs" db:"timestamp_ns"` IncomingAmtMsat *uint64 `json:"incomingAmtMsat" db:"incoming_amt_msat"` OutgoingAmtMsat *uint64 `json:"outgoingAmtMsat" db:"outgoing_amt_msat"` IncomingTimelock *uint32 `json:"incomingTimelock" db:"incoming_timelock"` OutgoingTimelock *uint32 `json:"outgoingTimelock" db:"outgoing_timelock"` BoltFailureCode *string `json:"boltFailureCode" db:"bolt_failure_code"` BoltFailureString *string `json:"boltFailureString" db:"bolt_failure_string"` LndFailureDetail *string `json:"lndFailureDetail" db:"lnd_failure_detail"` OutgoingChannelId *int `json:"outgoingChannelId" db:"outgoing_channel_id"` IncomingChannelId *int `json:"incomingChannelId" db:"incoming_channel_id"` NodeId int `json:"nodeId" db:"node_id"` }
type Invoice ¶ added in v0.4.6
type Invoice struct { /* An optional memo to attach along with the invoice. Used for record keeping purposes for the invoice's creator, and will also be set in the description field of the encoded payment request if the description_hash field is not being used. */ Memo string `db:"memo" json:"memo"` /* The hex-encoded preimage (32 byte) which will allow settling an incoming HTLC payable to this preimage. */ RPreimage string `db:"r_preimage" json:"r_preimage"` /* The hash of the preimage. */ RHash string `db:"r_hash" json:"r_hash"` // The value of the invoice ValueMsat int64 `db:"value_msat" json:"value_msat"` // When this invoice was created CreationDate time.Time `db:"creation_date" json:"creation_date"` // When this invoice was settled SettleDate time.Time `db:"settle_date" json:"settle_date"` /* A bare-bones invoice for a payment within the Lightning Network. With the details of the invoice, the sender has all the data necessary to send a payment to the recipient. */ PaymentRequest string `db:"payment_request" json:"payment_request"` /* A bare-bones invoice for a payment within the Lightning Network. With the details of the invoice, the sender has all the data necessary to send a payment to the recipient. */ Destination string `db:"destination_pub_key" json:"destination_pub_key"` /* Hash (SHA-256) of a description of the payment. Used if the description of payment (memo) is too long to naturally fit within the description field of an encoded payment request. */ DescriptionHash []byte `db:"description_hash" json:"description_hash"` // Payment request expiry time in seconds. Default is 3600 (1 hour). Expiry int64 `db:"expiry" json:"expiry"` // Fallback on-chain address. FallbackAddr string `db:"fallback_addr" json:"fallback_addr"` // Delta to use for the time-lock of the CLTV extended to the final hop. CltvExpiry uint64 `db:"cltv_expiry" json:"cltv_expiry"` /* Route hints that can each be individually used to assist in reaching the invoice's destination. */ //repeated RouteHint route_hints = 14; RouteHints []byte `db:"route_hints" json:"route_hints"` // Whether this invoice should include routing hints for private channels. Private bool `db:"private" json:"private"` /* The "add" index of this invoice. Each newly created invoice will increment this index making it monotonically increasing. Callers to the SubscribeInvoices call can use this to instantly get notified of all added invoices with an add_index greater than this one. */ AddIndex uint64 `db:"add_index" json:"add_index"` /* The "settle" index of this invoice. Each newly settled invoice will increment this index making it monotonically increasing. Callers to the SubscribeInvoices call can use this to instantly get notified of all settled invoices with an settle_index greater than this one. */ SettleIndex uint64 `db:"settle_index" json:"settle_index"` /* The amount that was accepted for this invoice, in satoshis. This will ONLY be set if this invoice has been settled. We provide this field as if the invoice was created with a zero value, then we need to record what amount was ultimately accepted. Additionally, it's possible that the sender paid MORE that was specified in the original invoice. So we'll record that here as well. */ AmtPaidSat int64 `db:"amt_paid_sat" json:"amt_paid_sat"` /* The amount that was accepted for this invoice, in millisatoshis. This will ONLY be set if this invoice has been settled. We provide this field as if the invoice was created with a zero value, then we need to record what amount was ultimately accepted. Additionally, it's possible that the sender paid MORE that was specified in the original invoice. So we'll record that here as well. */ AmtPaidMsat int64 `db:"amt_paid_msat" json:"amt_paid_msat"` InvoiceState string `db:"invoice_state" json:"invoice_state"` // List of HTLCs paying to this invoice [EXPERIMENTAL]. Htlcs []byte `db:"htlcs" json:"htlcs"` // List of features advertised on the invoice. //map<uint32, Feature> features = 24; // features []*lnrpc.Feature Features []byte `db:"features" json:"features"` /* Indicates if this invoice was a spontaneous payment that arrived via keysend [EXPERIMENTAL]. */ IsKeysend bool `db:"is_keysend" json:"is_keysend"` /* The payment address of this invoice. This value will be used in MPP payments, and also for newer invoices that always require the MPP payload for added end-to-end security. */ PaymentAddr string `db:"payment_addr" json:"payment_addr"` /* Signals whether this is an AMP invoice. */ IsAmp bool `db:"is_amp" json:"is_amp"` /* [EXPERIMENTAL]: Maps a 32-byte hex-encoded set ID to the sub-invoice AMP state for the given set ID. This field is always populated for AMP invoices, and can be used alongside LookupInvoice to obtain the HTLC information related to a given sub-invoice. */ //map<string, AMPInvoiceState> amp_invoice_state = 28; AmpInvoiceState []byte `db:"amp_invoice_state" json:"amp_invoice_state"` DestinationNodeId *int `db:"destination_node_id" json:"destinationNodeId"` NodeId int `db:"node_id" json:"nodeId"` ChannelId *int `db:"channel_id" json:"channelId"` CreatedOn time.Time `db:"created_on" json:"created_on"` UpdatedOn time.Time `db:"updated_on" json:"updated_on"` }
type PayOptions ¶ added in v0.4.6
PayOptions allows the caller to adjust the number of payments can be requested at a time and set a custom time interval between requests.
type Payment ¶ added in v0.4.6
type Payment struct { PaymentIndex uint64 `json:"payment_index" db:"payment_index"` PaymentHash string `json:"payment_hash" db:"payment_hash"` PaymentPreimage string `json:"payment_preimage" db:"payment_preimage"` PaymentRequest string `json:"payment_request" db:"payment_request"` Status string `json:"status" db:"status"` ValueMsat int64 `json:"value_msat" db:"value_msat"` FeeMsat int64 `json:"fee_msat" db:"fee_msat"` Htlcs []byte `json:"htlcs" db:"htlcs"` FailureReason string `json:"failure_reason" db:"failure_reason"` CreationTimeNs int64 `json:"creation_time_ns" db:"creation_time_ns"` CreationTimestamp int64 `json:"creation_timestamp" db:"creation_timestamp"` }
type Tx ¶ added in v0.11.0
type Tx struct { Timestamp time.Time `json:"timestamp" db:"timestamp"` TransactionHash *string `json:"transactionHash" db:"tx_hash"` Amount *int64 `json:"amount" db:"amount"` NumberOfConfirmations *int32 `json:"numberOfConfirmations" db:"num_confirmations"` BlockHash *string `json:"blockHash" db:"block_hash"` BlockHeight *int32 `json:"blockHeight" db:"block_height"` TotalFees *int64 `json:"totalFees" db:"total_fees"` DestinationAddresses *[]string `json:"destinationAddresses" db:"dest_addresses"` RawTransactionHex *string `json:"rawTransactionHex" db:"raw_tx_hex"` Label *string `json:"label" db:"label"` NodeId int `json:"nodeId" db:"node_id"` }