Expand description
Various utilities for building scripts related to channels. These are
largely of interest for those implementing the traits on crate::sign by hand.
Structs§
- Built
Commitment Transaction - A pre-built Bitcoin commitment transaction and its txid.
- Channel
Public Keys - One counterparty’s public keys which do not change over the life of a channel.
- Channel
Transaction Parameters - Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction). The fields are organized by holder/counterparty.
- Closing
Transaction - This class tracks the per-transaction information needed to build a closing transaction and will actually build it and sign.
- Commitment
Transaction - This class tracks the per-transaction information needed to build a commitment transaction and will actually build it and sign. It is used for holder transactions that we sign only when needed and for transactions we sign for the counterparty.
- Counterparty
Channel Transaction Parameters - Late-bound per-channel counterparty data used to build transactions.
- Counterparty
Commitment Secrets - Implements the per-commitment secret storage scheme from BOLT 3.
- Directed
Channel Transaction Parameters - Static channel fields used to build transactions given per-commitment fields, organized by broadcaster/countersignatory.
- HTLC
Output InCommitment - Information about an HTLC as it appears in a commitment transaction
- Holder
Commitment Transaction - Information needed to build and sign a holder’s commitment transaction.
- Trusted
Closing Transaction - A wrapper on ClosingTransaction indicating that the built bitcoin transaction is trusted.
- Trusted
Commitment Transaction - A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin transaction and the transaction creation keys) are trusted.
- TxCreation
Keys - The set of public keys which are used in the creation of one commitment transaction. These are derived from the channel base keys and per-commitment data.
Enums§
- HTLC
Claim - Describes the type of HTLC claim as determined by analyzing the witness.
Constants§
- ANCHOR_
INPUT_ WITNESS_ WEIGHT - The upper bound weight of an anchor input.
- EMPTY_
WITNESS_ WEIGHT - The weight of an empty witness; used to spend a P2A output.
- FUNDING_
TRANSACTION_ WITNESS_ WEIGHT - The weight of a funding transaction input (2-of-2 P2WSH).
- HTLC_
SUCCESS_ INPUT_ KEYED_ ANCHOR_ WITNESS_ WEIGHT - The upper bound weight of an HTLC success input from a commitment transaction with keyed anchor outputs.
- HTLC_
SUCCESS_ INPUT_ P2A_ ANCHOR_ WITNESS_ WEIGHT - The upper bound weight of an HTLC success input from a commitment transaction with a p2a anchor output. Note the corresponding outputs no longer have the 1 CSV lock.
- HTLC_
TIMEOUT_ INPUT_ KEYED_ ANCHOR_ WITNESS_ WEIGHT - The upper bound weight of an HTLC timeout input from a commitment transaction with keyed anchor outputs.
- HTLC_
TIMEOUT_ INPUT_ P2A_ ANCHOR_ WITNESS_ WEIGHT - The upper bound weight of an HTLC timeout input from a commitment transaction with a p2a anchor output. Note the corresponding outputs no longer have the 1 CSV lock.
- MAX_
ACCEPTED_ HTLC_ SCRIPT_ WEIGHT - The weight of a BIP141 witnessScript for a BOLT3’s “received HTLC output” can vary in function of its CLTV argument value. We define a range that encompasses both its non-anchors and anchors variants. This is the maximum post-anchor value.
- OFFERED_
HTLC_ SCRIPT_ WEIGHT - The weight of a BIP141 witnessScript for a BOLT3’s “offered HTLC output” on a commitment transaction, non-anchor and p2a anchor variant.
- OFFERED_
HTLC_ SCRIPT_ WEIGHT_ KEYED_ ANCHORS - The weight of a BIP141 witnessScript for a BOLT3’s “offered HTLC output” on a commitment transaction, keyed anchor variant.
- P2A_
MAX_ VALUE - The maximum value of a P2A anchor.
- REVOKEABLE_
REDEEMSCRIPT_ MAX_ LENGTH - The maximum length of a script returned by get_revokeable_redeemscript.
- TRUC_
CHILD_ MAX_ WEIGHT - The maximum weight of a TRUC transaction with an unconfirmed TRUC ancestor, see BIP431.
- TRUC_
MAX_ WEIGHT - The maximum weight of a TRUC transaction, see BIP431.
Functions§
- aggregated_
htlc_ success_ input_ output_ pair_ weight - Gets the weight of a single input-output pair in externally funded HTLC-success transactions
- aggregated_
htlc_ timeout_ input_ output_ pair_ weight - Gets the weight of a single input-output pair in externally funded HTLC-timeout transactions
- build_
closing_ transaction - Build a closing transaction
- build_
commitment_ secret - Build the commitment secret from the seed and the commitment number
- build_
htlc_ input_ witness - Returns the witness required to satisfy and spend a HTLC input.
- build_
htlc_ transaction - Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
parameters. This is used by
TrustedCommitmentTransaction::get_htlc_sigsto fetch the transaction which needs signing, and can be used to construct an HTLC transaction which is broadcastable given a counterparty HTLC signature. - build_
keyed_ anchor_ input_ witness - Returns the witness required to satisfy and spend a keyed anchor (non-zero-fee-commitments) input.
- derive_
private_ key - Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) from the base secret and the per_commitment_point.
- derive_
private_ revocation_ key - Derives a per-commitment-transaction revocation key from its constituent parts.
- get_
commitment_ transaction_ number_ obscure_ factor - Commitment transaction numbers which appear in the transactions themselves are XOR’d with a shared secret first. This prevents on-chain observers from discovering how many commitment transactions occurred in a channel before it was closed.
- get_
countersigner_ payment_ script - Returns the script for the countersigner’s (i.e. non-broadcaster’s) output on a commitment transaction based on the channel type.
- get_
htlc_ redeemscript - Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc does not need to have its previous_output_index filled.
- get_
keyed_ anchor_ redeemscript - Gets the witnessScript for a keyed anchor (non-zero-fee-commitments) output from the funding public key.
- get_
revokeable_ redeemscript - A script either spendable by the revocation
key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
Encumbering a
to_holderoutput on a commitment transaction or 2nd-stage HTLC transactions. - get_
to_ countersigner_ keyed_ anchor_ redeemscript - Gets the witnessScript for the to_remote output when anchors are enabled.
- htlc_
success_ tx_ weight - Gets the weight for an HTLC-Success transaction.
- htlc_
timeout_ tx_ weight - Gets the weight for an HTLC-Timeout transaction.
- make_
funding_ redeemscript - Gets the redeemscript for a funding output from the two funding public keys. Note that the order of funding public keys does not matter.
- max_
htlcs - Maximum number of in-flight HTLCs in each direction allowed by the lightning protocol.
- shared_
anchor_ script_ pubkey - Gets the script_pubkey for a shared anchor