Documentation
¶
Index ¶
- func ChangeOutput(params *address.AddressParameters, amount btcutil.Amount) (*swapserverrpc.StaticAddressChangeOutput, error)
- func CleanupMusig2Sessions(ctx context.Context, signer lndclient.SignerClient, ...) error
- func CreateMusig2Session(ctx context.Context, signer lndclient.SignerClient, d *deposit.Deposit) (*input.MuSig2SessionInfo, error)
- func CreateMusig2Sessions(ctx context.Context, signer lndclient.SignerClient, ...) ([]*input.MuSig2SessionInfo, [][]byte, error)
- func CreateMusig2SessionsPerDeposit(ctx context.Context, signer lndclient.SignerClient, ...) (map[string]*input.MuSig2SessionInfo, map[string][]byte, map[string]int, error)
- func DepositAddressDescriptors(deposits []*deposit.Deposit) (map[string]*swapserverrpc.StaticAddressDescriptor, error)
- func GetPrevoutInfo(prevOuts map[wire.OutPoint]*wire.TxOut) []*swapserverrpc.PrevoutInfo
- func SelectDeposits(deposits []*deposit.Deposit, amount int64, feeRate chainfee.SatPerKWeight, ...) ([]*deposit.Deposit, error)
- func ToPrevOuts(deposits []*deposit.Deposit) (map[wire.OutPoint]*wire.TxOut, error)
- func ToWireOutpoints(outpoints []*lnrpc.OutPoint) ([]wire.OutPoint, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeOutput ¶
func ChangeOutput(params *address.AddressParameters, amount btcutil.Amount) (*swapserverrpc.StaticAddressChangeOutput, error)
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 ¶
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.
Types ¶
This section is empty.