Struct lightning::sign::HTLCDescriptor

source ·
pub struct HTLCDescriptor {
    pub channel_derivation_parameters: ChannelDerivationParameters,
    pub commitment_txid: Txid,
    pub per_commitment_number: u64,
    pub per_commitment_point: PublicKey,
    pub feerate_per_kw: u32,
    pub htlc: HTLCOutputInCommitment,
    pub preimage: Option<PaymentPreimage>,
    pub counterparty_sig: Signature,
}
Expand description

A descriptor used to sign for a commitment transaction’s HTLC output.

Fields§

§channel_derivation_parameters: ChannelDerivationParameters

The parameters required to derive the signer for the HTLC input.

§commitment_txid: Txid

The txid of the commitment transaction in which the HTLC output lives.

§per_commitment_number: u64

The number of the commitment transaction in which the HTLC output lives.

§per_commitment_point: PublicKey

The key tweak corresponding to the number of the commitment transaction in which the HTLC output lives. This tweak is applied to all the basepoints for both parties in the channel to arrive at unique keys per commitment.

See https://github.com/lightning/bolts/blob/master/03-transactions.md#keys for more info.

§feerate_per_kw: u32

The feerate to use on the HTLC claiming transaction. This is always 0 for HTLCs originating from a channel supporting anchor outputs, otherwise it is the channel’s negotiated feerate at the time the commitment transaction was built.

§htlc: HTLCOutputInCommitment

The details of the HTLC as it appears in the commitment transaction.

§preimage: Option<PaymentPreimage>

The preimage, if Some, to claim the HTLC output with. If None, the timeout path must be taken.

§counterparty_sig: Signature

The counterparty’s signature required to spend the HTLC output.

Implementations§

source§

impl HTLCDescriptor

source

pub fn outpoint(&self) -> OutPoint

Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint being spent by the HTLC input in the HTLC transaction.

source

pub fn previous_utxo<C: Signing + Verification>( &self, secp: &Secp256k1<C> ) -> TxOut

Returns the UTXO to be spent by the HTLC input, which can be obtained via Self::unsigned_tx_input.

source

pub fn unsigned_tx_input(&self) -> TxIn

Returns the unsigned transaction input spending the HTLC output in the commitment transaction.

source

pub fn tx_output<C: Signing + Verification>(&self, secp: &Secp256k1<C>) -> TxOut

Returns the delayed output created as a result of spending the HTLC output in the commitment transaction.

source

pub fn witness_script<C: Signing + Verification>( &self, secp: &Secp256k1<C> ) -> ScriptBuf

Returns the witness script of the HTLC output in the commitment transaction.

source

pub fn tx_input_witness( &self, signature: &Signature, witness_script: &Script ) -> Witness

Returns the fully signed witness required to spend the HTLC output in the commitment transaction.

source

pub fn derive_channel_signer<S: WriteableEcdsaChannelSigner, SP: Deref>( &self, signer_provider: &SP ) -> S
where SP::Target: SignerProvider<EcdsaSigner = S>,

Derives the channel signer required to sign the HTLC input.

Trait Implementations§

source§

impl Clone for HTLCDescriptor

source§

fn clone(&self) -> HTLCDescriptor

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for HTLCDescriptor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for HTLCDescriptor

source§

fn eq(&self, other: &HTLCDescriptor) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Readable for HTLCDescriptor

source§

fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError>

Reads a Self in from the given Read.
source§

impl Writeable for HTLCDescriptor

source§

fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>

Writes self out to the given Writer.
source§

fn serialized_length(&self) -> usize

Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length.
source§

fn encode(&self) -> Vec<u8>

Writes self out to a Vec<u8>.
source§

impl Eq for HTLCDescriptor

source§

impl StructuralPartialEq for HTLCDescriptor

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> MaybeReadable for T
where T: Readable,

source§

fn read<R>(reader: &mut R) -> Result<Option<T>, DecodeError>
where R: Read,

Reads a Self in from the given Read.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.