staticutil

package
v0.36.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 17 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

This section is empty.

Variables

This section is empty.

Functions

func ChangeOutput

ChangeOutput converts a locally generated static address into the RPC change descriptor sent to the server. The descriptor binds the expected script, amount and client key so the server can derive and verify the same address.

func CleanupMusig2Sessions

func CleanupMusig2Sessions(ctx context.Context,
	signer lndclient.SignerClient,
	sessions map[string]*input.MuSig2SessionInfo) error

CleanupMusig2Sessions releases all supplied MuSig2 sessions.

func CreateMusig2Session

func CreateMusig2Session(ctx context.Context,
	signer lndclient.SignerClient, d *deposit.Deposit) (
	*input.MuSig2SessionInfo, error)

CreateMusig2Session creates a musig2 session for the deposit's static address.

func CreateMusig2Sessions

func CreateMusig2Sessions(ctx context.Context,
	signer lndclient.SignerClient, deposits []*deposit.Deposit) (
	[]*input.MuSig2SessionInfo,
	[][]byte, error)

CreateMusig2Sessions creates a musig2 session for a number of deposits.

func CreateMusig2SessionsPerDeposit

func CreateMusig2SessionsPerDeposit(ctx context.Context,
	signer lndclient.SignerClient, deposits []*deposit.Deposit) (
	map[string]*input.MuSig2SessionInfo, map[string][]byte, map[string]int,
	error)

CreateMusig2SessionsPerDeposit creates a musig2 session for a number of deposits and returns the sessions keyed by outpoint string.

The per-deposit keying mirrors the server response format and avoids relying on positional ordering after the request crosses the wire.

func DepositAddressDescriptors

func DepositAddressDescriptors(deposits []*deposit.Deposit) (
	map[string]*swapserverrpc.StaticAddressDescriptor, error)

DepositAddressDescriptors maps each deposit outpoint to the static address descriptor that derives that output.

The server receives this proof material with swap and withdrawal requests and verifies it against the L402's server key and expiry before co-signing any input. Root and derived addresses use the same descriptor format. The server can recognize the root by matching the client public key to its stored root address; other client keys identify derived addresses. The descriptor carries no derivation key family or index.

func GetPrevoutInfo

func GetPrevoutInfo(prevOuts map[wire.OutPoint]*wire.TxOut,
) []*swapserverrpc.PrevoutInfo

GetPrevoutInfo converts a map of prevOuts to protobuf.

func SelectDeposits

func SelectDeposits(deposits []*deposit.Deposit, amount int64,
	feeRate chainfee.SatPerKWeight,
	commitmentType lnrpc.CommitmentType) ([]*deposit.Deposit, error)

SelectDeposits sorts the deposits by amount in descending order. It then selects the deposits that are needed to cover the requested amount plus transaction fees and dust. The fee rate and commitment type are used to estimate the transaction fee for the current selection, since each additional input increases the fee.

func ToPrevOuts

func ToPrevOuts(deposits []*deposit.Deposit) (
	map[wire.OutPoint]*wire.TxOut, error)

ToPrevOuts converts a slice of deposits to a map of outpoints to TxOuts.

Each deposit carries the static address parameters that produced its output. Using the per-deposit script here keeps signing correct when one transaction spends deposits from multiple static addresses.

func ToWireOutpoints

func ToWireOutpoints(outpoints []*lnrpc.OutPoint) ([]wire.OutPoint, error)

ToWireOutpoints converts lnrpc.OutPoint protos into wire.OutPoint structs so they can be consumed by lower level transaction building code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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