backends

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseLogger

func UseLogger(logger logging.Logger)

UseLogger tells the backends package which logger to use

Types

type Backend

type Backend interface {
	Connect() error

	// The amount is denominated in satoshis and the expiry in seconds
	GetInvoice(description string, amount int64, expiry int64) (invoice string, rHash string, err error)

	InvoiceSettled(rHash string) (settled bool, err error)

	SubscribeInvoices(publish PublishInvoiceSettled, rescan RescanPendingInvoices) error

	KeepAliveRequest() error
}

Backend is an interface that would allow for different implementations of Lightning to be used as backend

type LND

type LND struct {
	GRPCHost     string `long:"grpchost" Description:"Host of the gRPC interface of LND"`
	CertFile     string `long:"certfile" Description:"TLS certificate for the LND gRPC and REST services"`
	MacaroonFile string `long:"macaroonfile" Description:"Macaroon file for authentication. Set to an empty string for no macaroon"`
	// contains filtered or unexported fields
}

LND contains all values needed to be able to connect to a node

func (*LND) Connect

func (lnd *LND) Connect() error

Connect to a node

func (*LND) GetInvoice

func (lnd *LND) GetInvoice(message string, amount int64, expiry int64) (invoice string, rHash string, err error)

GetInvoice gets and invoice from a node

func (*LND) InvoiceSettled

func (lnd *LND) InvoiceSettled(rHash string) (settled bool, err error)

InvoiceSettled checks if an invoice is settled by looking it up

func (*LND) KeepAliveRequest

func (lnd *LND) KeepAliveRequest() error

KeepAliveRequest is a dummy request to make sure the connection to LND doesn't time out if LND and LightningTip are separated with a firewall

func (*LND) SubscribeInvoices

func (lnd *LND) SubscribeInvoices(publish PublishInvoiceSettled, rescan RescanPendingInvoices) error

SubscribeInvoices subscribe to the invoice events of LND and calls a callback when one is settled

type PublishInvoiceSettled

type PublishInvoiceSettled func(invoice string)

PublishInvoiceSettled is a callback for a settled invoice

type RescanPendingInvoices

type RescanPendingInvoices func()

RescanPendingInvoices is a callbacks when reconnecting

Jump to

Keyboard shortcuts

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