Documentation ¶
Index ¶
- func CheckError(t *testing.T, err error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString() (string, error)
- func GetBitcoinCliBinary() (string, error)
- func GetBitcoindBinary() (string, error)
- func GetLightningdBinary() (string, error)
- func GetLndBinary() (string, error)
- func GetPort() (uint32, error)
- func GetPreserveLogs() bool
- func GetPreserveState() bool
- func GetTestRootDir() (*string, error)
- func PerformCleanup(cleanups []*Cleanup)
- type ChannelDetails
- type ChannelInfo
- type Cleanable
- type Cleanup
- type CleanupFunc
- type ClnNode
- func (n *ClnNode) CaCertPath() string
- func (n *ClnNode) ClientCertPath() string
- func (n *ClnNode) ClientKeyPath() string
- func (n *ClnNode) ConnectPeer(peer LightningNode)
- func (n *ClnNode) CreateBolt11Invoice(options *CreateInvoiceOptions) *CreateInvoiceResult
- func (n *ClnNode) Fund(amountSat uint64)
- func (n *ClnNode) GetChannels() []*ChannelDetails
- func (n *ClnNode) GetInvoice(paymentHash []byte) *GetInvoiceResponse
- func (n *ClnNode) GetNewAddress() string
- func (n *ClnNode) GetPeerFeatures(peerId []byte) map[uint32]string
- func (n *ClnNode) GetRemoteNodeFeatures(nodeId []byte) map[uint32]string
- func (n *ClnNode) GetRoute(destination []byte, amountMsat uint64) *Route
- func (n *ClnNode) GrpcPort() uint32
- func (n *ClnNode) Host() string
- func (n *ClnNode) IsStarted() bool
- func (n *ClnNode) NodeId() []byte
- func (n *ClnNode) OpenChannel(peer LightningNode, options *OpenChannelOptions) *ChannelInfo
- func (n *ClnNode) Pay(bolt11 string) *PayResult
- func (n *ClnNode) PayViaRoute(amountMsat uint64, paymentHash []byte, paymentSecret []byte, route *Route) (*PayResult, error)
- func (n *ClnNode) Port() uint32
- func (n *ClnNode) PrivateKey() *secp256k1.PrivateKey
- func (n *ClnNode) SendCustomMessage(req *CustomMsgRequest)
- func (n *ClnNode) SendToAddress(addr string, amountSat uint64)
- func (n *ClnNode) SignMessage(message []byte) []byte
- func (n *ClnNode) SocketDir() string
- func (n *ClnNode) SocketFile() string
- func (n *ClnNode) Start()
- func (n *ClnNode) Stop() error
- func (n *ClnNode) WaitForChannelReady(channel *ChannelInfo) ShortChannelID
- func (n *ClnNode) WaitForSync()
- type CreateInvoiceOptions
- type CreateInvoiceResult
- type CustomMsgRequest
- type GetInvoiceResponse
- type HarnessOption
- type Hop
- type InvoiceStatus
- type LightningNode
- type LndNode
- func (n *LndNode) Conn() grpc.ClientConnInterface
- func (n *LndNode) ConnectPeer(peer LightningNode)
- func (n *LndNode) CreateBolt11Invoice(options *CreateInvoiceOptions) *CreateInvoiceResult
- func (n *LndNode) Fund(amountSat uint64)
- func (n *LndNode) GetChannels() []*ChannelDetails
- func (n *LndNode) GetInvoice(paymentHash []byte) *GetInvoiceResponse
- func (n *LndNode) GetNewAddress() string
- func (n *LndNode) GetPeerFeatures(peerId []byte) map[uint32]string
- func (n *LndNode) GetRemoteNodeFeatures(nodeId []byte) map[uint32]string
- func (n *LndNode) GetRoute(destination []byte, amountMsat uint64) *Route
- func (n *LndNode) GrpcHost() string
- func (n *LndNode) Host() string
- func (n *LndNode) IsStarted() bool
- func (n *LndNode) LightningClient() lnd.LightningClient
- func (n *LndNode) Macaroon() []byte
- func (n *LndNode) NodeId() []byte
- func (n *LndNode) OpenChannel(peer LightningNode, options *OpenChannelOptions) *ChannelInfo
- func (n *LndNode) Pay(bolt11 string) *PayResult
- func (n *LndNode) PayViaRoute(amountMsat uint64, paymentHash []byte, paymentSecret []byte, route *Route) (*PayResult, error)
- func (n *LndNode) Port() uint32
- func (n *LndNode) PrivateKey() *secp256k1.PrivateKey
- func (n *LndNode) SendCustomMessage(msg *CustomMsgRequest)
- func (n *LndNode) SendToAddress(addr string, amountSat uint64)
- func (n *LndNode) SignMessage(message []byte) []byte
- func (n *LndNode) Start()
- func (n *LndNode) Stop() error
- func (n *LndNode) TlsCert() []byte
- func (n *LndNode) WaitForChannelReady(channel *ChannelInfo) ShortChannelID
- func (n *LndNode) WaitForSync()
- type MacaroonCredential
- type Miner
- func (m *Miner) GetBlockHeight() uint32
- func (m *Miner) MineBlocks(n uint)
- func (m *Miner) SendToAddress(addr string, amountSat uint64)
- func (m *Miner) SendToAddressAndMine(addr string, amountSat uint64, blocks uint)
- func (m *Miner) Start()
- func (m *Miner) Stop() error
- func (m *Miner) ZmqBlockAddress() string
- func (m *Miner) ZmqTxAddress() string
- type OpenChannelOptions
- type PayResult
- type PayViaRouteResponse
- type Route
- type ShortChannelID
- type Stoppable
- type TestHarness
- func (h *TestHarness) AddCleanable(cleanable Cleanable)
- func (h *TestHarness) AddStoppable(stoppable Stoppable)
- func (h *TestHarness) Deadline() time.Time
- func (h *TestHarness) GetDirectory(pattern string) string
- func (h *TestHarness) RegisterLogfile(path string, name string)
- func (h *TestHarness) TearDown()
- type WaitPaymentCompleteResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
func GenerateRandomBytes ¶
func GenerateRandomString ¶
func GetBitcoinCliBinary ¶
func GetBitcoindBinary ¶
func GetLightningdBinary ¶
func GetLndBinary ¶
func GetPreserveLogs ¶
func GetPreserveLogs() bool
func GetPreserveState ¶
func GetPreserveState() bool
func GetTestRootDir ¶
func PerformCleanup ¶
func PerformCleanup(cleanups []*Cleanup)
Runs the cleanup functions in reverse order.
Types ¶
type ChannelDetails ¶
type ChannelDetails struct { PeerId []byte ShortChannelID ShortChannelID CapacityMsat uint64 LocalReserveMsat uint64 RemoteReserveMsat uint64 LocalSpendableMsat uint64 RemoteSpendableMsat uint64 LocalAlias *ShortChannelID RemoteAlias *ShortChannelID }
type ChannelInfo ¶
type ChannelInfo struct { From LightningNode To LightningNode FundingTxId []byte FundingTxOutnum uint32 }
func (*ChannelInfo) GetPeer ¶
func (c *ChannelInfo) GetPeer(this LightningNode) LightningNode
func (*ChannelInfo) WaitForChannelReady ¶
func (c *ChannelInfo) WaitForChannelReady() ShortChannelID
type Cleanup ¶
type Cleanup struct { Name string Fn CleanupFunc }
type CleanupFunc ¶
type CleanupFunc func() error
type ClnNode ¶
type ClnNode struct {
// contains filtered or unexported fields
}
func NewClnNode ¶
func NewClnNode(h *TestHarness, m *Miner, name string, extraArgs ...string) *ClnNode
func NewClnNodeFromBinary ¶
func (*ClnNode) CaCertPath ¶
func (*ClnNode) ClientCertPath ¶
func (*ClnNode) ClientKeyPath ¶
func (*ClnNode) ConnectPeer ¶
func (n *ClnNode) ConnectPeer(peer LightningNode)
func (*ClnNode) CreateBolt11Invoice ¶
func (n *ClnNode) CreateBolt11Invoice(options *CreateInvoiceOptions) *CreateInvoiceResult
func (*ClnNode) GetChannels ¶
func (n *ClnNode) GetChannels() []*ChannelDetails
func (*ClnNode) GetInvoice ¶
func (n *ClnNode) GetInvoice(paymentHash []byte) *GetInvoiceResponse
func (*ClnNode) GetNewAddress ¶
func (*ClnNode) GetPeerFeatures ¶
func (*ClnNode) GetRemoteNodeFeatures ¶
func (*ClnNode) OpenChannel ¶
func (n *ClnNode) OpenChannel(peer LightningNode, options *OpenChannelOptions) *ChannelInfo
func (*ClnNode) PayViaRoute ¶
func (*ClnNode) PrivateKey ¶
func (n *ClnNode) PrivateKey() *secp256k1.PrivateKey
func (*ClnNode) SendCustomMessage ¶
func (n *ClnNode) SendCustomMessage(req *CustomMsgRequest)
func (*ClnNode) SendToAddress ¶
func (*ClnNode) SignMessage ¶
func (*ClnNode) SocketFile ¶
func (*ClnNode) WaitForChannelReady ¶
func (n *ClnNode) WaitForChannelReady(channel *ChannelInfo) ShortChannelID
func (*ClnNode) WaitForSync ¶
func (n *ClnNode) WaitForSync()
type CreateInvoiceOptions ¶
type CreateInvoiceResult ¶
type CustomMsgRequest ¶
type GetInvoiceResponse ¶
type HarnessOption ¶
type HarnessOption int
const ( DumpLogs HarnessOption = 0 PreserveLogs HarnessOption = 1 PreserveState HarnessOption = 2 )
type InvoiceStatus ¶
type InvoiceStatus int32
const ( Invoice_UNPAID InvoiceStatus = 0 Invoice_PAID InvoiceStatus = 1 Invoice_EXPIRED InvoiceStatus = 2 )
type LightningNode ¶
type LightningNode interface { Stoppable NodeId() []byte Host() string Port() uint32 Start() IsStarted() bool PrivateKey() *secp256k1.PrivateKey WaitForSync() GetNewAddress() string Fund(amountSat uint64) ConnectPeer(peer LightningNode) OpenChannel(peer LightningNode, options *OpenChannelOptions) *ChannelInfo WaitForChannelReady(channel *ChannelInfo) ShortChannelID CreateBolt11Invoice(options *CreateInvoiceOptions) *CreateInvoiceResult SignMessage(message []byte) []byte Pay(bolt11 string) *PayResult GetRoute(destination []byte, amountMsat uint64) *Route PayViaRoute( amountMsat uint64, paymentHash []byte, paymentSecret []byte, route *Route) (*PayResult, error) GetInvoice(paymentHash []byte) *GetInvoiceResponse GetPeerFeatures(peerId []byte) map[uint32]string GetRemoteNodeFeatures(nodeId []byte) map[uint32]string GetChannels() []*ChannelDetails SendToAddress(addr string, amountSat uint64) SendCustomMessage(req *CustomMsgRequest) }
type LndNode ¶
type LndNode struct {
// contains filtered or unexported fields
}
func NewLndNode ¶
func NewLndNode(h *TestHarness, m *Miner, name string, extraArgs ...string) *LndNode
func NewLndNodeFromBinary ¶
func (*LndNode) Conn ¶
func (n *LndNode) Conn() grpc.ClientConnInterface
func (*LndNode) ConnectPeer ¶
func (n *LndNode) ConnectPeer(peer LightningNode)
func (*LndNode) CreateBolt11Invoice ¶
func (n *LndNode) CreateBolt11Invoice(options *CreateInvoiceOptions) *CreateInvoiceResult
func (*LndNode) GetChannels ¶
func (n *LndNode) GetChannels() []*ChannelDetails
func (*LndNode) GetInvoice ¶
func (n *LndNode) GetInvoice(paymentHash []byte) *GetInvoiceResponse
func (*LndNode) GetNewAddress ¶
func (*LndNode) GetPeerFeatures ¶
func (*LndNode) GetRemoteNodeFeatures ¶
func (*LndNode) LightningClient ¶
func (n *LndNode) LightningClient() lnd.LightningClient
func (*LndNode) OpenChannel ¶
func (n *LndNode) OpenChannel(peer LightningNode, options *OpenChannelOptions) *ChannelInfo
func (*LndNode) PayViaRoute ¶
func (*LndNode) PrivateKey ¶
func (n *LndNode) PrivateKey() *secp256k1.PrivateKey
func (*LndNode) SendCustomMessage ¶
func (n *LndNode) SendCustomMessage(msg *CustomMsgRequest)
func (*LndNode) SendToAddress ¶
func (*LndNode) SignMessage ¶
func (*LndNode) WaitForChannelReady ¶
func (n *LndNode) WaitForChannelReady(channel *ChannelInfo) ShortChannelID
func (*LndNode) WaitForSync ¶
func (n *LndNode) WaitForSync()
type MacaroonCredential ¶
type MacaroonCredential struct {
Macaroon []byte
}
func NewMacaroonCredential ¶
func NewMacaroonCredential(m []byte) *MacaroonCredential
func NewMacaroonCredentialFromFile ¶
func NewMacaroonCredentialFromFile(path string) (*MacaroonCredential, error)
func (*MacaroonCredential) GetRequestMetadata ¶
func (*MacaroonCredential) RequireTransportSecurity ¶
func (m *MacaroonCredential) RequireTransportSecurity() bool
type Miner ¶
type Miner struct {
// contains filtered or unexported fields
}
func NewMiner ¶
func NewMiner(h *TestHarness) *Miner
func NewMinerFromBinary ¶
func NewMinerFromBinary(h *TestHarness, binary string) *Miner
func (*Miner) GetBlockHeight ¶
func (*Miner) MineBlocks ¶
func (*Miner) SendToAddress ¶
func (*Miner) SendToAddressAndMine ¶
func (*Miner) ZmqBlockAddress ¶
func (*Miner) ZmqTxAddress ¶
type OpenChannelOptions ¶
type PayViaRouteResponse ¶
type PayViaRouteResponse struct {
PartId uint32
}
type ShortChannelID ¶
func NewShortChanIDFromInt ¶
func NewShortChanIDFromInt(chanID uint64) ShortChannelID
func NewShortChanIDFromString ¶
func NewShortChanIDFromString(chanID string) ShortChannelID
func (ShortChannelID) String ¶
func (c ShortChannelID) String() string
func (ShortChannelID) ToUint64 ¶
func (c ShortChannelID) ToUint64() uint64
type TestHarness ¶
type TestHarness struct { *testing.T Ctx context.Context Dir string // contains filtered or unexported fields }
func NewTestHarness ¶
func NewTestHarness(t *testing.T, deadline time.Time, options ...HarnessOption) *TestHarness
func (*TestHarness) AddCleanable ¶
func (h *TestHarness) AddCleanable(cleanable Cleanable)
func (*TestHarness) AddStoppable ¶
func (h *TestHarness) AddStoppable(stoppable Stoppable)
func (*TestHarness) Deadline ¶
func (h *TestHarness) Deadline() time.Time
func (*TestHarness) GetDirectory ¶
func (h *TestHarness) GetDirectory(pattern string) string
func (*TestHarness) RegisterLogfile ¶
func (h *TestHarness) RegisterLogfile(path string, name string)
func (*TestHarness) TearDown ¶
func (h *TestHarness) TearDown()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.