Documentation ¶
Index ¶
- Constants
- func Connect(host string, tlsCert []byte, macaroonBytes []byte) (*grpc.ClientConn, error)
- func ImportChannelList(t lnrpc.ChannelEventUpdate_UpdateType, db *sqlx.DB, ...) error
- func ImportMissingNodeEvents(client lnrpc.LightningClient, db *sqlx.DB) error
- func ImportRoutingPolicies(client lnrpc.LightningClient, db *sqlx.DB) error
- func ImportTransactions(ctx context.Context, client lnrpc.LightningClient, db *sqlx.DB) error
- func InitChanIdList(db *sqlx.DB) error
- func InitOurNodesList(ctx context.Context, client lnrpc.LightningClient, db *sqlx.DB) error
- func InitPeerList(db *sqlx.DB) error
- func SubscribeAndStoreChannelEvents(ctx context.Context, client lndClientSubscribeChannelEvent, db *sqlx.DB, ...) error
- func SubscribeAndStoreChannelGraph(ctx context.Context, client subscribeChannelGrpahClient, db *sqlx.DB) error
- func SubscribeAndStoreHtlcEvents(ctx context.Context, router routerrpc.RouterClient, db *sqlx.DB) error
- func SubscribeAndStoreInvoices(ctx context.Context, client invoicesClient, db *sqlx.DB) error
- func SubscribeAndStorePayments(ctx context.Context, client lightningClient_ListPayments, db *sqlx.DB, ...) error
- func SubscribeAndStoreTransactions(ctx context.Context, client lnrpc.LightningClient, db *sqlx.DB) error
- func SubscribeAndUpdatePayments(ctx context.Context, client lightningClient_ListPayments, db *sqlx.DB, ...) error
- func SubscribeForwardingEvents(ctx context.Context, client lightningClientForwardingHistory, db *sqlx.DB, ...) error
- func UpdateChanIdList(c chan string)
- func UpdatePeerList(c chan string)
- type FwhOptions
- type Invoice
- type PayOptions
- type Payment
Constants ¶
const MAXEVENTS int = 50000
MAXEVENTS is used to set the maximum events in ForwardingHistoryRequest. It's also used to check if we need to request more.
Variables ¶
This section is empty.
Functions ¶
func ImportChannelList ¶
func ImportChannelList(t lnrpc.ChannelEventUpdate_UpdateType, db *sqlx.DB, client lnrpc.LightningClient) error
func ImportMissingNodeEvents ¶
func ImportMissingNodeEvents(client lnrpc.LightningClient, db *sqlx.DB) error
ImportMissingNodeEvents imports information about all nodes that we have had a channel with.
func ImportRoutingPolicies ¶
func ImportRoutingPolicies(client lnrpc.LightningClient, db *sqlx.DB) error
ImportRoutingPolicies imports routing policy information about all open channels if they don't already have
func ImportTransactions ¶
func InitChanIdList ¶
func InitOurNodesList ¶
func InitPeerList ¶
InitPeerList fetches all public keys from the list of all channels. This is used to filter out noise from the graph updates.
func SubscribeAndStoreChannelEvents ¶
func SubscribeAndStoreChannelEvents(ctx context.Context, client lndClientSubscribeChannelEvent, db *sqlx.DB, pubKeyChan chan string, chanPoinChan chan string) error
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 subscribeChannelGrpahClient, db *sqlx.DB) error
SubscribeAndStoreChannelGraph Subscribes to channel updates
func SubscribeAndStoreHtlcEvents ¶
func SubscribeAndStoreHtlcEvents(ctx context.Context, router routerrpc.RouterClient, db *sqlx.DB) error
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 SubscribeAndStoreTransactions ¶
func SubscribeAndStoreTransactions(ctx context.Context, client lnrpc.LightningClient, db *sqlx.DB) error
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 SubscribeAndUpdatePayments ¶ added in v0.4.6
func SubscribeForwardingEvents ¶
func SubscribeForwardingEvents(ctx context.Context, client lightningClientForwardingHistory, db *sqlx.DB, opt *FwhOptions) error
SubscribeForwardingEvents repeatedly requests forwarding history starting after the last forwarding stored in the database and stores new forwards.
func UpdateChanIdList ¶
func UpdateChanIdList(c chan string)
func UpdatePeerList ¶
func UpdatePeerList(c chan string)
UpdatePeerList is meant to run as a gorouting. It adds new public keys to the pubKeyList and removes existing ones.
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 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"` 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"` }