rpc

package
v0.15.10001 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO(yy): remove once temp tests is finished.
	DefaultTimeout = lntest.DefaultTimeout
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HarnessRPC

type HarnessRPC struct {
	*testing.T

	LN               lnrpc.LightningClient
	WalletUnlocker   lnrpc.WalletUnlockerClient
	Invoice          invoicesrpc.InvoicesClient
	Signer           signrpc.SignerClient
	Router           routerrpc.RouterClient
	WalletKit        walletrpc.WalletKitClient
	Watchtower       watchtowerrpc.WatchtowerClient
	WatchtowerClient wtclientrpc.WatchtowerClientClient
	State            lnrpc.StateClient
	ChainClient      chainrpc.ChainNotifierClient
	ChainKit         chainrpc.ChainKitClient
	NeutrinoKit      neutrinorpc.NeutrinoKitClient
	Peer             peersrpc.PeersClient

	// Name is the HarnessNode's name.
	Name string
	// contains filtered or unexported fields
}

HarnessRPC wraps all lnd's RPC clients into a single struct for easier access.

func NewHarnessRPC

func NewHarnessRPC(ctxt context.Context, t *testing.T, c *grpc.ClientConn,
	name string) *HarnessRPC

NewHarnessRPC creates a new HarnessRPC with its own context inherted from the pass context.

func (*HarnessRPC) AbandonChannel

AbandonChannel makes a RPC call to AbandonChannel and asserts.

func (*HarnessRPC) AddHoldInvoice

AddHoldInvoice adds a hold invoice for the given node and asserts.

func (*HarnessRPC) AddInvoice

func (h *HarnessRPC) AddInvoice(req *lnrpc.Invoice) *lnrpc.AddInvoiceResponse

AddInvoice adds a invoice for the given node and asserts.

func (*HarnessRPC) AddPeer

AddPeer makes an RPC call to neutrino kit client's AddPeer and asserts.

func (*HarnessRPC) BatchOpenChannel

BatchOpenChannel makes a RPC call to BatchOpenChannel and asserts.

func (*HarnessRPC) BatchOpenChannelAssertErr

func (h *HarnessRPC) BatchOpenChannelAssertErr(
	req *lnrpc.BatchOpenChannelRequest) error

BatchOpenChannelAssertErr makes a RPC call to BatchOpenChannel and asserts there's an error returned.

func (*HarnessRPC) CancelInvoice

func (h *HarnessRPC) CancelInvoice(
	payHash []byte) *invoicesrpc.CancelInvoiceResp

CancelInvoice cancels a given invoice and asserts.

func (*HarnessRPC) ChannelAcceptor

func (h *HarnessRPC) ChannelAcceptor() (AcceptorClient, context.CancelFunc)

ChannelAcceptor makes a RPC call to the node's ChannelAcceptor and asserts.

func (*HarnessRPC) ChannelBalance

func (h *HarnessRPC) ChannelBalance() *lnrpc.ChannelBalanceResponse

ChannelBalance gets the channel balance and asserts.

func (*HarnessRPC) CloseChannel

func (h *HarnessRPC) CloseChannel(
	req *lnrpc.CloseChannelRequest) CloseChanClient

CloseChannel makes a rpc call to LightningClient and returns the close channel client.

func (*HarnessRPC) ClosedChannels

ClosedChannels makes a RPC call to node's ClosedChannels and asserts.

func (*HarnessRPC) ConnectPeer

ConnectPeer makes a RPC call to ConnectPeer and asserts there's no error.

func (*HarnessRPC) ConnectPeerAssertErr

func (h *HarnessRPC) ConnectPeerAssertErr(req *lnrpc.ConnectPeerRequest) error

ConnectPeerAssertErr makes a RPC call to ConnectPeer and asserts an error returned.

func (*HarnessRPC) DeleteAllPayments

func (h *HarnessRPC) DeleteAllPayments()

DeleteAllPayments makes a RPC call to the node's DeleteAllPayments and asserts.

func (*HarnessRPC) DeriveKey

func (h *HarnessRPC) DeriveKey(kl *signrpc.KeyLocator) *signrpc.KeyDescriptor

DeriveKey makes a RPC call to the DeriveKey and asserts.

func (*HarnessRPC) DeriveNextKey

func (h *HarnessRPC) DeriveNextKey(
	req *walletrpc.KeyReq) *signrpc.KeyDescriptor

DeriveNextKey makes a RPC call to the DeriveNextKey and asserts.

func (*HarnessRPC) DescribeGraph

func (h *HarnessRPC) DescribeGraph(
	req *lnrpc.ChannelGraphRequest) *lnrpc.ChannelGraph

DescribeGraph makes a RPC call to the node's DescribeGraph and asserts. It takes a bool to indicate whether we want to include private edges or not.

func (*HarnessRPC) DisconnectPeer

func (h *HarnessRPC) DisconnectPeer(
	pubkey string) *lnrpc.DisconnectPeerResponse

DisconnectPeer calls the DisconnectPeer RPC on a given node with a specified public key string and asserts there's no error.

func (*HarnessRPC) ExportAllChanBackups

func (h *HarnessRPC) ExportAllChanBackups() *lnrpc.ChanBackupSnapshot

ExportAllChanBackups makes a RPC call to the node's ExportAllChannelBackups and asserts.

func (*HarnessRPC) ExportChanBackup

func (h *HarnessRPC) ExportChanBackup(
	chanPoint *lnrpc.ChannelPoint) *lnrpc.ChannelBackup

ExportChanBackup makes a RPC call to the node's ExportChannelBackup and asserts.

func (*HarnessRPC) FinalizePsbt

FinalizePsbt makes a RPC call to node's FinalizePsbt and asserts.

func (*HarnessRPC) FundPsbt

FundPsbt makes a RPC call to node's FundPsbt and asserts.

func (*HarnessRPC) FundingStateStep

func (h *HarnessRPC) FundingStateStep(
	msg *lnrpc.FundingTransitionMsg) *lnrpc.FundingStateStepResp

FundingStateStep makes a RPC call to FundingStateStep and asserts.

func (*HarnessRPC) FundingStateStepAssertErr

func (h *HarnessRPC) FundingStateStepAssertErr(m *lnrpc.FundingTransitionMsg)

FundingStateStepAssertErr makes a RPC call to FundingStateStep and asserts there's an error.

func (*HarnessRPC) GenSeed

GenSeed makes a RPC request to WalletUnlocker and asserts there's no error.

func (*HarnessRPC) GetBestBlock

GetBestBlock makes an RPC call to chain kit client's GetBestBlock and asserts.

func (*HarnessRPC) GetBlock

GetBlock makes an RPC call to chain kit client's GetBlock and asserts.

func (*HarnessRPC) GetBlockHash

GetBlockHash makes an RPC call to chain kit client's GetBlockHash and asserts.

func (*HarnessRPC) GetCFilter

GetCFilter makes an RPC call to neutrino kit client's GetCFilter and asserts.

func (*HarnessRPC) GetInfo

func (h *HarnessRPC) GetInfo() *lnrpc.GetInfoResponse

GetInfo calls the GetInfo RPC on a given node and asserts there's no error.

func (*HarnessRPC) GetRecoveryInfo

GetRecoveryInfo uses the specified node to make a RPC call to GetRecoveryInfo and asserts.

func (*HarnessRPC) GetTransactions

func (h *HarnessRPC) GetTransactions(
	req *lnrpc.GetTransactionsRequest) *lnrpc.TransactionDetails

GetTransactions makes a RPC call to GetTransactions and asserts.

func (*HarnessRPC) InitWallet

InitWallet makes a RPC request to WalletUnlocker and asserts there's no error.

func (*HarnessRPC) LabelTransaction

func (h *HarnessRPC) LabelTransaction(req *walletrpc.LabelTransactionRequest)

LabelTransaction makes a RPC call to the node's LabelTransaction and asserts no error is returned.

func (*HarnessRPC) LabelTransactionAssertErr

func (h *HarnessRPC) LabelTransactionAssertErr(
	req *walletrpc.LabelTransactionRequest) error

LabelTransactionAssertErr makes a RPC call to the node's LabelTransaction and asserts an error is returned. It then returns the error.

func (*HarnessRPC) ListAddresses

ListAddresses makes a RPC call to the ListAddresses and asserts.

func (*HarnessRPC) ListChannels

ListChannels list the channels for the given node and asserts it's successful.

func (*HarnessRPC) ListInvoices

ListInvoices list the node's invoice using the request and asserts.

func (*HarnessRPC) ListPayments

ListPayments lists the node's payments and asserts.

func (*HarnessRPC) ListPeers

func (h *HarnessRPC) ListPeers() *lnrpc.ListPeersResponse

ListPeers makes a RPC call to the node's ListPeers and asserts.

func (*HarnessRPC) ListSweeps

func (h *HarnessRPC) ListSweeps(verbose bool) *walletrpc.ListSweepsResponse

ListSweeps makes a ListSweeps RPC call to the node's WalletKit client.

func (*HarnessRPC) ListUnspent

FinalizePsbt makes a RPC call to node's ListUnspent and asserts.

func (*HarnessRPC) LookupInvoiceV2

func (h *HarnessRPC) LookupInvoiceV2(
	req *invoicesrpc.LookupInvoiceMsg) *lnrpc.Invoice

LookupInvoiceV2 queries the node's invoices using the invoice client's LookupInvoiceV2.

func (*HarnessRPC) MakeOutpoint

func (h *HarnessRPC) MakeOutpoint(cp *lnrpc.ChannelPoint) wire.OutPoint

MakeOutpoint returns the outpoint of the channel's funding transaction.

func (*HarnessRPC) NewAddress

NewAddress makes a RPC call to NewAddress and asserts.

func (*HarnessRPC) NoError

func (h *HarnessRPC) NoError(err error, operation string)

NoError is a helper method to format the error message used in calling RPCs.

func (*HarnessRPC) OpenChannel

func (h *HarnessRPC) OpenChannel(req *lnrpc.OpenChannelRequest) OpenChanClient

OpenChannel makes a rpc call to LightningClient and returns the open channel client.

func (*HarnessRPC) PendingChannels

func (h *HarnessRPC) PendingChannels() *lnrpc.PendingChannelsResponse

PendingChannels makes a RPC request to PendingChannels and asserts there's no error.

func (*HarnessRPC) PendingSweeps

func (h *HarnessRPC) PendingSweeps() *walletrpc.PendingSweepsResponse

PendingSweeps makes a RPC call to the node's WalletKitClient and asserts.

func (*HarnessRPC) PublishTransaction

func (h *HarnessRPC) PublishTransaction(
	req *walletrpc.Transaction) *walletrpc.PublishResponse

PublishTransaction makes an RPC call to the node's WalletKitClient and asserts.

func (*HarnessRPC) QueryRoutes

QueryRoutes makes a RPC call to QueryRoutes and asserts.

func (*HarnessRPC) RestoreChanBackups

RestoreChanBackups makes a RPC call to the node's RestoreChannelBackups and asserts.

func (*HarnessRPC) SendCoins

SendCoins sends a given amount of money to the specified address from the passed node.

func (*HarnessRPC) SendCoinsAssertErr

func (h *HarnessRPC) SendCoinsAssertErr(req *lnrpc.SendCoinsRequest)

SendCoinsAssertErr sends a given amount of money to the specified address from the passed node and asserts an error has returned.

func (*HarnessRPC) SendOutputs

SendOutputs makes a RPC call to the node's WalletKitClient and asserts.

func (*HarnessRPC) SendPayment

func (h *HarnessRPC) SendPayment(
	req *routerrpc.SendPaymentRequest) PaymentClient

SendPayment sends a payment using the given node and payment request. It also asserts the payment being sent successfully.

func (*HarnessRPC) SendToRoute

func (h *HarnessRPC) SendToRoute() lnrpc.Lightning_SendToRouteClient

SendToRoute makes a RPC call to SendToRoute and asserts.

func (*HarnessRPC) SendToRouteSync

func (h *HarnessRPC) SendToRouteSync(
	req *lnrpc.SendToRouteRequest) *lnrpc.SendResponse

SendToRouteSync makes a RPC call to SendToRouteSync and asserts.

func (*HarnessRPC) SettleInvoice

func (h *HarnessRPC) SettleInvoice(
	preimage []byte) *invoicesrpc.SettleInvoiceResp

SettleInvoice settles a given invoice and asserts.

func (*HarnessRPC) SignMessage

func (h *HarnessRPC) SignMessage(msg []byte) *lnrpc.SignMessageResponse

SignMessage makes a RPC call to node's SignMessage and asserts.

func (*HarnessRPC) SignOutputRaw

func (h *HarnessRPC) SignOutputRaw(req *signrpc.SignReq) *signrpc.SignResp

SignOutputRaw makes a RPC call to node's SignOutputRaw and asserts.

func (*HarnessRPC) Status

Status makes an RPC call to neutrino kit client's Status and asserts.

func (*HarnessRPC) SubscribeChannelBackups

func (h *HarnessRPC) SubscribeChannelBackups() BackupSubscriber

SubscribeChannelBackups creates a client to listen to channel backup stream.

func (*HarnessRPC) SubscribeInvoices

func (h *HarnessRPC) SubscribeInvoices(
	req *lnrpc.InvoiceSubscription) InvoiceUpdateClient

SubscribeInvoices creates a subscription client for invoice events and asserts its creation.

NOTE: make sure to subscribe an invoice as early as possible as it takes some time for the lnd to create the subscription client. If an invoice is added right after the subscription, it may be missed. However, if AddIndex or SettleIndex is used in the request, it will be fine as a backlog will always be sent.

func (*HarnessRPC) SubscribeSingleInvoice

func (h *HarnessRPC) SubscribeSingleInvoice(rHash []byte) SingleInvoiceClient

SubscribeSingleInvoice creates a subscription client for given invoice and asserts its creation.

func (*HarnessRPC) SubscribeState

func (h *HarnessRPC) SubscribeState() lnrpc.State_SubscribeStateClient

SubscribeState makes a rpc call to StateClient and asserts there's no error.

func (*HarnessRPC) UnlockWallet

UnlockWallet makes a RPC request to WalletUnlocker and asserts there's no error.

func (*HarnessRPC) UpdateChanStatus

UpdateChanStatus makes a UpdateChanStatus RPC call to node's RouterClient and asserts.

func (*HarnessRPC) UpdateChannelPolicy

func (h *HarnessRPC) UpdateChannelPolicy(
	req *lnrpc.PolicyUpdateRequest) *lnrpc.PolicyUpdateResponse

UpdateChannelPolicy makes a RPC call to UpdateChannelPolicy and asserts.

func (*HarnessRPC) UpdateNodeAnnouncement

func (h *HarnessRPC) UpdateNodeAnnouncement(req AnnReq) AnnResp

UpdateNodeAnnouncement makes an UpdateNodeAnnouncement RPC call the peersrpc client and asserts.

func (*HarnessRPC) UpdateNodeAnnouncementErr

func (h *HarnessRPC) UpdateNodeAnnouncementErr(req AnnReq)

UpdateNodeAnnouncementErr makes an UpdateNodeAnnouncement RPC call the peersrpc client and asserts an error is returned.

func (*HarnessRPC) VerifyChanBackup

VerifyChanBackup makes a RPC call to node's VerifyChanBackup and asserts.

func (*HarnessRPC) VerifyMessage

func (h *HarnessRPC) VerifyMessage(msg []byte,
	sig string) *lnrpc.VerifyMessageResponse

VerifyMessage makes a RPC call to node's VerifyMessage and asserts.

func (*HarnessRPC) WalletBalance

func (h *HarnessRPC) WalletBalance() *lnrpc.WalletBalanceResponse

WalletBalance makes a RPC call to WalletBalance and asserts.

Jump to

Keyboard shortcuts

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