openchannel

package
v0.32.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const Subsystem = "SCHOPEN"

Subsystem defines the sub system name of this package.

Variables

View Source
var (
	ErrOpeningChannelUnavailableDeposits = errors.New("some deposits are " +
		"not usable to open a channel with")
)

Functions

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type AddressManager

type AddressManager interface {
	// GetStaticAddressParameters returns the static address parameters.
	GetStaticAddressParameters(ctx context.Context) (*address.Parameters,
		error)

	// GetStaticAddress returns the deposit address for the given
	// client and server public keys.
	GetStaticAddress(ctx context.Context) (*script.StaticAddress, error)
}

AddressManager handles fetching of address parameters.

type Config

type Config struct {
	// StaticAddressServerClient is the client that calls the swap server
	// rpcs to negotiate static address withdrawals.
	Server serverrpc.StaticAddressServerClient

	// AddressManager gives the withdrawal manager access to static address
	// parameters.
	AddressManager AddressManager

	// DepositManager gives the withdrawal manager access to the deposits
	// enabling it to create and manage withdrawals.
	DepositManager DepositManager

	// WithdrawalManager is used to create the withdrawal transaction into
	// the channel funding address.
	WithdrawalManager WithdrawalManager

	// WalletKit is the wallet client that is used to derive new keys from
	// lnd's wallet.
	WalletKit lndclient.WalletKitClient

	// ChainParams is the chain configuration(mainnet, testnet...) this
	// manager uses.
	ChainParams *chaincfg.Params

	// ChainNotifier is the chain notifier that is used to listen for new
	// blocks.
	ChainNotifier lndclient.ChainNotifierClient

	// Signer is the signer client that is used to sign transactions.
	Signer lndclient.SignerClient

	// LightningClient is the lnd client that is used to open channels.
	LightningClient lndclient.LightningClient
}

Config is the configuration struct for the open channel manager.

type DepositManager

type DepositManager interface {
	// AllOutpointsActiveDeposits returns all deposits that are in the
	// given state. If the state filter is fsm.StateTypeNone, all deposits
	// are returned.
	AllOutpointsActiveDeposits(outpoints []wire.OutPoint,
		stateFilter fsm.StateType) ([]*deposit.Deposit, bool)

	// GetActiveDepositsInState returns all deposits that are in the
	// given state.
	GetActiveDepositsInState(stateFilter fsm.StateType) ([]*deposit.Deposit,
		error)

	// TransitionDeposits transitions the deposits to the given state.
	TransitionDeposits(ctx context.Context, deposits []*deposit.Deposit,
		event fsm.EventType, expectedFinalState fsm.StateType) error
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is the main struct that handles the open channel manager.

func NewManager

func NewManager(cfg *Config) *Manager

NewManager creates a new manager instance.

func (*Manager) DeliverOpenChannelRequest

func (m *Manager) DeliverOpenChannelRequest(ctx context.Context,
	req *lnrpc.OpenChannelRequest) (*wire.OutPoint, error)

DeliverOpenChannelRequest forwards a open channel request to the manager main loop.

func (*Manager) OpenChannel

func (m *Manager) OpenChannel(ctx context.Context,
	req *lnrpc.OpenChannelRequest) (*wire.OutPoint, error)

OpenChannel transitions the requested deposits into the OpeningChannel state and then starts the open channel psbt flow between the client's lnd instance and the server.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context) error

Run runs the open channel manager.

type WithdrawalManager

type WithdrawalManager interface {
	CreateFinalizedWithdrawalTx(ctx context.Context,
		deposits []*deposit.Deposit, withdrawalAddress btcutil.Address,
		feeRate chainfee.SatPerKWeight,
		selectedWithdrawalAmount int64,
		commitmentType lnrpc.CommitmentType) (*wire.MsgTx, []byte, error)
}

Jump to

Keyboard shortcuts

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