Documentation
¶
Index ¶
- Constants
- Variables
- func Bip69Less(output1, output2 *wire.TxOut) bool
- func CheckAddrNetwork(addr btcutil.Address, params *chaincfg.Params) error
- func ClampSweepFee(fee btcutil.Amount, totalAmount btcutil.Amount, ratio float64, ...) (btcutil.Amount, bool, error)
- func DustLimitForPkScript(pkscript []byte) btcutil.Amount
- func GetHtlc(hash lntypes.Hash, contract *loopdb.SwapContract, chainParams *chaincfg.Params) (*swap.Htlc, error)
- func GetHtlcScriptVersion(protocolVersion loopdb.ProtocolVersion) swap.ScriptVersion
- func IsSupportedDestAddr(addr btcutil.Address) bool
- func MuSig2Sign(version input.MuSig2Version, keys [][32]byte, tweaks *input.MuSig2Tweaks, ...) ([]byte, error)
- func ObtainLoopOutPaymentAddr(contract *loopdb.LoopOutContract, chainParams *chaincfg.Params) (*[32]byte, error)
- func ObtainSwapPaymentAddr(swapInvoice string, chainParams *chaincfg.Params) (*[32]byte, error)deprecated
Constants ¶
const ( // MaxFeeToAmountRatio is the maximum fee to total amount ratio allowed // for a sweep transaction. MaxFeeToAmountRatio = 0.2 )
Variables ¶
var ErrWrongNetwork = errors.New("address belongs to another network")
ErrWrongNetwork is returned when an address belongs to another network than the active one.
Functions ¶
func CheckAddrNetwork ¶
CheckAddrNetwork returns an error wrapping ErrWrongNetwork if addr does not belong to the network with the given chain parameters. The decoder accepts bech32 addresses of all known networks, and their output scripts don't depend on the network.
func ClampSweepFee ¶
func ClampSweepFee(fee btcutil.Amount, totalAmount btcutil.Amount, ratio float64, minRelayFeeRate chainfee.SatPerKWeight, weight lntypes.WeightUnit) (btcutil.Amount, bool, error)
ClampSweepFee caps a fee to a percentage of the provided total amount and verifies the resulting fee rate is not below the minimum relay fee. It returns the clamped fee, whether it was clamped, or an error if the clamped fee would fall below the minimum relay fee.
func DustLimitForPkScript ¶
DustLimitForPkScript returns the dust limit for a given pkScript. An output must be greater or equal to this value.
func GetHtlc ¶
func GetHtlc(hash lntypes.Hash, contract *loopdb.SwapContract, chainParams *chaincfg.Params) (*swap.Htlc, error)
GetHtlc composes and returns the on-chain swap script.
func GetHtlcScriptVersion ¶
func GetHtlcScriptVersion( protocolVersion loopdb.ProtocolVersion) swap.ScriptVersion
GetHtlcScriptVersion returns the correct HTLC script version for the passed protocol version.
func IsSupportedDestAddr ¶
IsSupportedDestAddr returns whether addr has a type that Loop pays swap and sweep outputs to: P2PKH, P2SH, P2WPKH, P2WSH or P2TR. It rejects any other type that an address decoder may return, such as a raw public key or a pay-to-anchor output, which anyone can spend.
func MuSig2Sign ¶
func MuSig2Sign(version input.MuSig2Version, keys [][32]byte, tweaks *input.MuSig2Tweaks, msg [32]byte) ([]byte, error)
MuSig2Sign will create a MuSig2 signature for the passed message using the passed raw private keys. Raw keys are interpreted with btcec.PrivKeyFromBytes semantics, which normalize 32-byte inputs modulo the secp256k1 group order instead of rejecting out-of-range values. Keys that normalize to zero (zero itself and the group order) are rejected. It expects at least two signing keys.
func ObtainLoopOutPaymentAddr ¶
func ObtainLoopOutPaymentAddr(contract *loopdb.LoopOutContract, chainParams *chaincfg.Params) (*[32]byte, error)
ObtainLoopOutPaymentAddr returns the secret used to authenticate loop-out RPCs. Blinded invoices require a separately supplied, persisted secret. Ordinary invoices retain their invoice-derived secret, including old swaps.
Types ¶
This section is empty.