Enum lightning::chain::keysinterface::SpendableOutputDescriptor[][src]

pub enum SpendableOutputDescriptor {
    StaticOutput {
        outpoint: OutPoint,
        output: TxOut,
    },
    DelayedPaymentOutput(DelayedPaymentOutputDescriptor),
    StaticPaymentOutput(StaticPaymentOutputDescriptor),
}
Expand description

When on-chain outputs are created by rust-lightning (which our counterparty is not able to claim at any point in the future) an event is generated which you must track and be able to spend on-chain. The information needed to do this is provided in this enum, including the outpoint describing which txid and output index is available, the full output which exists at that txid/index, and any keys or other information required to sign.

Variants

StaticOutput

An output to a script which was provided via KeysInterface directly, either from get_destination_script() or get_shutdown_pubkey(), thus you should already know how to spend it. No secret keys are provided as rust-lightning was never given any key. These may include outputs from a transaction punishing our counterparty or claiming an HTLC on-chain using the payment preimage or after it has timed out.

Show fields

Fields of StaticOutput

outpoint: OutPoint

The outpoint which is spendable

output: TxOut

The output which is referenced by the given outpoint.

DelayedPaymentOutput(DelayedPaymentOutputDescriptor)

An output to a P2WSH script which can be spent with a single signature after a CSV delay.

The witness in the spending input should be: <BIP 143 signature> (MINIMALIF standard rule)

Note that the nSequence field in the spending input must be set to to_self_delay (which means the transaction is not broadcastable until at least to_self_delay blocks after the outpoint confirms).

These are generally the result of a “revocable” output to us, spendable only by us unless it is an output from an old state which we broadcast (which should never happen).

To derive the delayed_payment key which is used to sign for this input, you must pass the holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to chan_utils::derive_private_key. The public key can be generated without the secret key using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in Sign::pubkeys().

To derive the revocation_pubkey provided here (which is used in the witness script generation), you must pass the counterparty revocation_basepoint (which appears in the call to Sign::ready_channel) and the provided per_commitment point to chan_utils::derive_public_revocation_key.

The witness script which is hashed and included in the output script_pubkey may be regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey (derived as above), and the to_self_delay contained here to chan_utils::get_revokeable_redeemscript.

StaticPaymentOutput(StaticPaymentOutputDescriptor)

An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which corresponds to the public key in Sign::pubkeys().payment_point). The witness in the spending input, is, thus, simply: <BIP 143 signature>

These are generally the result of our counterparty having broadcast the current state, allowing us to claim the non-HTLC-encumbered outputs immediately.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Reads a Self in from the given Read

Writes self out to the given Writer

Writes self out to a Vec

Writes self out to a Vec

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. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.