openchannel

package
v0.35.3-beta Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Config

type Config struct {
	// 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

	// 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 {
	// EnsureDepositsFresh reconciles active deposits with the wallet view.
	EnsureDepositsFresh(ctx context.Context) error

	// 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