Documentation
¶
Index ¶
- Constants
- Variables
- func AssertWaitForBalanceChange(t *testing.T, node LightningNode, scid string, before uint64, ...) bool
- func AssertWaitForChannelBalance(t *testing.T, node LightningNode, scid string, expected, delta float64, ...) bool
- func BalanceChannel5050(node, peer *CLightningNode, scid string) error
- func FreePort(port int)
- func GenerateRandomString(n int) (string, error)
- func GenerateToLiquidWallet(node *LiquidNode, walletName string, bitcoin float64) error
- func GetFreePort() (port int, err error)
- func GetFreePorts(n int) ([]int, error)
- func ReadConfig(filename string) (map[string]string, error)
- func RequireWaitForBalanceChange(t *testing.T, node LightningNode, scid string, before uint64, ...)
- func RequireWaitForChannelBalance(t *testing.T, node LightningNode, scid string, expected, delta float64, ...)
- func ScidFromLndChanId(id uint64) string
- func SplitLnAddr(addr string) (string, string, int, error)
- func SwitchWallet(node *LiquidNode, walletName string) error
- func WaitFor(f WaitFunc, timeout time.Duration) error
- func WaitForWithErr(f WaitFuncWithErr, timeout time.Duration) error
- func WriteConfig(filename string, config map[string]string, regtestConfig map[string]string, ...)
- type BitcoinNode
- type CLightningNode
- func (n *CLightningNode) AddInvoice(amtSat uint64, desc, label string) (payreq string, err error)
- func (n *CLightningNode) Address() string
- func (n *CLightningNode) Connect(peer LightningNode, waitForConnection bool) error
- func (n *CLightningNode) FundWallet(sats uint64, mineBlock bool) (string, error)
- func (n *CLightningNode) GetBtcBalanceSat() (sats uint64, err error)
- func (n *CLightningNode) GetChannelBalanceSat(scid string) (sats uint64, err error)
- func (n *CLightningNode) GetDataDir() string
- func (n *CLightningNode) GetLatestInvoice() (string, error)
- func (n *CLightningNode) GetMemoFromPayreq(bolt11 string) (string, error)
- func (n *CLightningNode) GetScid(remote LightningNode) (string, error)
- func (n *CLightningNode) Id() string
- func (n *CLightningNode) IsBlockHeightSynced() (bool, error)
- func (n *CLightningNode) IsChannelActive(scid string) (bool, error)
- func (n *CLightningNode) IsConnected(remote LightningNode) (bool, error)
- func (n *CLightningNode) OpenChannel(remote LightningNode, capacity uint64, ...) (string, error)
- func (n *CLightningNode) PayInvoice(payreq string) error
- func (n *CLightningNode) Run(waitForReady, waitForBitcoinSynced bool) error
- func (n *CLightningNode) SendPay(bolt11, scid string) error
- func (n *CLightningNode) Shutdown() error
- func (n *CLightningNode) Stop() error
- type CLightningProxy
- type DaemonProcess
- func (d *DaemonProcess) AppendCmdLine(options []string)
- func (d *DaemonProcess) HasLog(regex string) (bool, error)
- func (d *DaemonProcess) Kill()
- func (d *DaemonProcess) Prefix() string
- func (d *DaemonProcess) Run()
- func (d *DaemonProcess) WaitForLog(regex string, timeout time.Duration) error
- func (d *DaemonProcess) WithCmd(cmd string)
- type IdGetter
- type IntIdGetter
- type LightningNode
- type LiquidNode
- type LndNode
- func (n *LndNode) AddInvoice(amt uint64, desc, _ string) (payreq string, err error)
- func (n *LndNode) Address() string
- func (n *LndNode) ChanIdFromScid(scid string) (uint64, error)
- func (n *LndNode) Connect(peer LightningNode, waitForConnection bool) error
- func (n *LndNode) FundWallet(sats uint64, mineBlock bool) (string, error)
- func (n *LndNode) GetBtcBalanceSat() (uint64, error)
- func (n *LndNode) GetChannelBalanceSat(scid string) (sats uint64, err error)
- func (n *LndNode) GetLatestInvoice() (payreq string, err error)
- func (n *LndNode) GetMemoFromPayreq(bolt11 string) (string, error)
- func (n *LndNode) GetScid(peer LightningNode) (scid string, err error)
- func (n *LndNode) HasPendingHtlcOnChannel(scid string) (bool, error)
- func (n *LndNode) Id() (id string)
- func (n *LndNode) IsBlockHeightSynced() (bool, error)
- func (n *LndNode) IsChannelActive(scid string) (bool, error)
- func (n *LndNode) IsConnected(remote LightningNode) (bool, error)
- func (n *LndNode) OpenChannel(peer LightningNode, capacity uint64, ...) (string, error)
- func (n *LndNode) PayInvoice(payreq string) error
- func (n *LndNode) Run(waitForReady, waitForBitcoinSynced bool) error
- func (n *LndNode) SendPay(bolt11, _ string) error
- func (n *LndNode) Stop() error
- type LndRpcClient
- type PortMap
- type RpcProxy
- type WaitFunc
- type WaitFuncWithErr
Constants ¶
View Source
const ( // Addresses to generate to LBTC_BURN = "ert1qfkht0df45q00kzyayagw6vqhfhe8ve7z7wecm0xsrkgmyulewlzqumq3ep" BTC_BURN = "2N61yGL5ZBy3yaiEM8312CuG78CBNQMWE4Y" )
Variables ¶
View Source
var TIMEOUT = setTimeout()
Functions ¶
func AssertWaitForBalanceChange ¶
func AssertWaitForBalanceChange(t *testing.T, node LightningNode, scid string, before uint64, timeout time.Duration) bool
AssertWaitForBalanceChange waits for a change form the before value until timeout. Returns false if timeout was triggered and fails the test.
func BalanceChannel5050 ¶
func BalanceChannel5050(node, peer *CLightningNode, scid string) error
func GenerateRandomString ¶
func GenerateToLiquidWallet ¶
func GenerateToLiquidWallet(node *LiquidNode, walletName string, bitcoin float64) error
func GetFreePort ¶
func GetFreePorts ¶
func RequireWaitForBalanceChange ¶
func RequireWaitForBalanceChange(t *testing.T, node LightningNode, scid string, before uint64, timeout time.Duration)
RequireWaitForBalanceChange waits for a change from the before value until timeout. Fatals the test.
func ScidFromLndChanId ¶
func SwitchWallet ¶
func SwitchWallet(node *LiquidNode, walletName string) error
func WaitForWithErr ¶
func WaitForWithErr(f WaitFuncWithErr, timeout time.Duration) error
WaitForWithErr takes a WaitFuncWithErr and checks for true every 100ms.
Types ¶
type BitcoinNode ¶
type BitcoinNode struct { *DaemonProcess *RpcProxy DataDir string ConfigFile string RpcPort int RpcUser string RpcPassword string WalletName string ZmqPubRawTx string ZmqPubRawBlock string }
func NewBitcoinNode ¶
func NewBitcoinNode(testDir string, id int) (*BitcoinNode, error)
func (*BitcoinNode) GenerateBlocks ¶
func (n *BitcoinNode) GenerateBlocks(b int) error
func (*BitcoinNode) ReturnAsset ¶
func (n *BitcoinNode) ReturnAsset() string
func (*BitcoinNode) Run ¶
func (n *BitcoinNode) Run(generateInitialBlocks bool) error
type CLightningNode ¶
type CLightningNode struct { *DaemonProcess *CLightningProxy DataDir string ConfigFile string Port int Info *glightning.NodeInfo // contains filtered or unexported fields }
func NewCLightningNode ¶
func NewCLightningNode(testDir string, bitcoin *BitcoinNode, id int) (*CLightningNode, error)
func (*CLightningNode) AddInvoice ¶
func (n *CLightningNode) AddInvoice(amtSat uint64, desc, label string) (payreq string, err error)
func (*CLightningNode) Address ¶
func (n *CLightningNode) Address() string
func (*CLightningNode) Connect ¶
func (n *CLightningNode) Connect(peer LightningNode, waitForConnection bool) error
func (*CLightningNode) FundWallet ¶
func (n *CLightningNode) FundWallet(sats uint64, mineBlock bool) (string, error)
func (*CLightningNode) GetBtcBalanceSat ¶
func (n *CLightningNode) GetBtcBalanceSat() (sats uint64, err error)
func (*CLightningNode) GetChannelBalanceSat ¶
func (n *CLightningNode) GetChannelBalanceSat(scid string) (sats uint64, err error)
func (*CLightningNode) GetDataDir ¶
func (n *CLightningNode) GetDataDir() string
func (*CLightningNode) GetLatestInvoice ¶
func (n *CLightningNode) GetLatestInvoice() (string, error)
func (*CLightningNode) GetMemoFromPayreq ¶
func (n *CLightningNode) GetMemoFromPayreq(bolt11 string) (string, error)
func (*CLightningNode) GetScid ¶
func (n *CLightningNode) GetScid(remote LightningNode) (string, error)
func (*CLightningNode) Id ¶
func (n *CLightningNode) Id() string
func (*CLightningNode) IsBlockHeightSynced ¶
func (n *CLightningNode) IsBlockHeightSynced() (bool, error)
func (*CLightningNode) IsChannelActive ¶
func (n *CLightningNode) IsChannelActive(scid string) (bool, error)
func (*CLightningNode) IsConnected ¶
func (n *CLightningNode) IsConnected(remote LightningNode) (bool, error)
func (*CLightningNode) OpenChannel ¶
func (n *CLightningNode) OpenChannel(remote LightningNode, capacity uint64, connect, confirm, waitForActiveChannel bool) (string, error)
func (*CLightningNode) PayInvoice ¶
func (n *CLightningNode) PayInvoice(payreq string) error
func (*CLightningNode) Run ¶
func (n *CLightningNode) Run(waitForReady, waitForBitcoinSynced bool) error
func (*CLightningNode) SendPay ¶
func (n *CLightningNode) SendPay(bolt11, scid string) error
func (*CLightningNode) Shutdown ¶
func (n *CLightningNode) Shutdown() error
func (*CLightningNode) Stop ¶
func (n *CLightningNode) Stop() error
type CLightningProxy ¶
type CLightningProxy struct { Rpc *glightning.Lightning // contains filtered or unexported fields }
func NewCLightningProxy ¶
func NewCLightningProxy(socketFileName, dataDir string) (*CLightningProxy, error)
func (*CLightningProxy) StartProxy ¶
func (p *CLightningProxy) StartProxy() error
type DaemonProcess ¶
type DaemonProcess struct { CmdLine []string Cmd *exec.Cmd StdOut *lockedWriter StdErr *lockedWriter // contains filtered or unexported fields }
func NewDaemonProcess ¶
func NewDaemonProcess(cmdline []string, prefix string) *DaemonProcess
func (*DaemonProcess) AppendCmdLine ¶
func (d *DaemonProcess) AppendCmdLine(options []string)
func (*DaemonProcess) Kill ¶
func (d *DaemonProcess) Kill()
func (*DaemonProcess) Prefix ¶
func (d *DaemonProcess) Prefix() string
func (*DaemonProcess) Run ¶
func (d *DaemonProcess) Run()
func (*DaemonProcess) WaitForLog ¶
func (d *DaemonProcess) WaitForLog(regex string, timeout time.Duration) error
func (*DaemonProcess) WithCmd ¶
func (d *DaemonProcess) WithCmd(cmd string)
type IntIdGetter ¶
func (*IntIdGetter) NextId ¶
func (i *IntIdGetter) NextId() int
type LightningNode ¶
type LightningNode interface { Address() (addr string) Id() (id string) // GetBtcBalanceSat returns the total amount of sats on the nodes // wallet. GetBtcBalanceSat() (sats uint64, err error) // GetChannelBalanceSat returns the confirmed balance of a channel. // scid is given clightning style i.e `100x0x1`. GetChannelBalanceSat(scid string) (sats uint64, err error) // GetScid returns the short channel id with a peer in clightning style // i.e. `100x0x1`. GetScid(peer LightningNode) (scid string, err error) Connect(peer LightningNode, waitForConnection bool) error FundWallet(sats uint64, mineBlock bool) (addr string, err error) OpenChannel(peer LightningNode, capacity uint64, connect, confirm, waitForChannelActive bool) (scid string, err error) IsBlockHeightSynced() (bool, error) IsChannelActive(scid string) (bool, error) IsConnected(peer LightningNode) (bool, error) AddInvoice(amtSat uint64, desc, label string) (payreq string, err error) PayInvoice(payreq string) error SendPay(bolt11, scid string) error // GetLatestInvoice returns the latest invoice from the stack of created // invoices. GetLatestInvoice() (payreq string, err error) GetMemoFromPayreq(payreq string) (memo string, err error) Run(waitForReady, swaitForBitcoinSynced bool) error Stop() error }
type LiquidNode ¶
type LiquidNode struct { *DaemonProcess *RpcProxy DataDir string ConfigFile string Port int RpcPort int RpcUser string RpcPassword string WalletName string Network string // contains filtered or unexported fields }
func NewLiquidNode ¶
func NewLiquidNode(testDir string, bitcoin *BitcoinNode, id int) (*LiquidNode, error)
func (*LiquidNode) GenerateBlocks ¶
func (n *LiquidNode) GenerateBlocks(b int) error
func (*LiquidNode) ReturnAsset ¶
func (n *LiquidNode) ReturnAsset() string
func (*LiquidNode) Run ¶
func (n *LiquidNode) Run(generateInitialBlocks bool) error
func (*LiquidNode) SwitchWallet ¶
func (n *LiquidNode) SwitchWallet(wallet string) error
type LndNode ¶
type LndNode struct { *DaemonProcess *LndRpcClient DataDir string ConfigFile string RpcPort int ListenPort int TlsPath string MacaroonPath string Info *lnrpc.GetInfoResponse // contains filtered or unexported fields }
func NewLndNode ¶
func (*LndNode) AddInvoice ¶
func (*LndNode) Connect ¶
func (n *LndNode) Connect(peer LightningNode, waitForConnection bool) error
func (*LndNode) FundWallet ¶
func (*LndNode) GetBtcBalanceSat ¶
func (*LndNode) GetChannelBalanceSat ¶
func (*LndNode) GetLatestInvoice ¶
func (*LndNode) GetMemoFromPayreq ¶
func (*LndNode) HasPendingHtlcOnChannel ¶
func (*LndNode) IsBlockHeightSynced ¶
func (*LndNode) IsConnected ¶
func (n *LndNode) IsConnected(remote LightningNode) (bool, error)
func (*LndNode) OpenChannel ¶
func (*LndNode) PayInvoice ¶
type LndRpcClient ¶
type LndRpcClient struct { Rpc lnrpc.LightningClient RpcV2 routerrpc.RouterClient // contains filtered or unexported fields }
func NewLndRpcClient ¶
func NewLndRpcClient(host, certPath, macaroonPath string, options ...grpc.DialOption) (*LndRpcClient, error)
type RpcProxy ¶
func NewRpcProxy ¶
func (*RpcProxy) Call ¶
func (p *RpcProxy) Call(method string, parameters ...interface{}) (*jsonrpc.RPCResponse, error)
func (*RpcProxy) UpdateServiceUrl ¶
type WaitFunc ¶
type WaitFunc func() bool
WaitFunc returns just a bool value to check if the desired conditions are met.
type WaitFuncWithErr ¶
WaitFunc returns a bool value to check if the desired conditions are met. Also returns an error.
Click to show internal directories.
Click to hide internal directories.