InMemorySigner

Struct InMemorySigner 

Source
pub struct InMemorySigner {
    pub revocation_base_key: SecretKey,
    pub delayed_payment_base_key: SecretKey,
    pub htlc_base_key: SecretKey,
    pub commitment_seed: [u8; 32],
    /* private fields */
}
Expand description

A simple implementation of EcdsaChannelSigner that just keeps the private keys in memory.

This implementation performs no policy checks and is insufficient by itself as a secure external signer.

Fields§

§revocation_base_key: SecretKey

Holder secret key for blinded revocation pubkey.

§delayed_payment_base_key: SecretKey

Holder secret key used in an HTLC transaction.

§htlc_base_key: SecretKey

Holder HTLC secret key used in commitment transaction HTLC outputs.

§commitment_seed: [u8; 32]

Commitment seed.

Implementations§

Source§

impl InMemorySigner

Source

pub fn funding_key(&self, splice_parent_funding_txid: Option<Txid>) -> SecretKey

Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the holder’s anchor output in a commitment transaction, if one is present.

Source

pub fn sign_counterparty_payment_input<C: Signing>( &self, spend_tx: &Transaction, input_idx: usize, descriptor: &StaticPaymentOutputDescriptor, secp_ctx: &Secp256k1<C>, ) -> Result<Witness, ()>

Sign the single input of spend_tx at index input_idx, which spends the output described by descriptor, returning the witness stack for the input.

Returns an error if the input at input_idx does not exist, has a non-empty script_sig, is not spending the outpoint described by descriptor.outpoint, or if an output descriptor script_pubkey does not match the one we can spend.

Source

pub fn sign_dynamic_p2wsh_input<C: Signing>( &self, spend_tx: &Transaction, input_idx: usize, descriptor: &DelayedPaymentOutputDescriptor, secp_ctx: &Secp256k1<C>, ) -> Result<Witness, ()>

Sign the single input of spend_tx at index input_idx which spends the output described by descriptor, returning the witness stack for the input.

Returns an error if the input at input_idx does not exist, has a non-empty script_sig, is not spending the outpoint described by descriptor.outpoint, does not have a sequence set to descriptor.to_self_delay, or if an output descriptor script_pubkey does not match the one we can spend.

Trait Implementations§

Source§

impl ChannelSigner for InMemorySigner

Source§

fn get_per_commitment_point( &self, idx: u64, secp_ctx: &Secp256k1<All>, ) -> Result<PublicKey, ()>

Gets the per-commitment point for a specific commitment number Read more
Source§

fn release_commitment_secret(&self, idx: u64) -> Result<[u8; 32], ()>

Gets the commitment secret for a specific commitment number as part of the revocation process Read more
Source§

fn validate_holder_commitment( &self, _holder_tx: &HolderCommitmentTransaction, _outbound_htlc_preimages: Vec<PaymentPreimage>, ) -> Result<(), ()>

Validate the counterparty’s signatures on the holder commitment transaction and HTLCs. Read more
Source§

fn validate_counterparty_revocation( &self, _idx: u64, _secret: &SecretKey, ) -> Result<(), ()>

Validate the counterparty’s revocation. Read more
Source§

fn new_pubkeys( &self, splice_parent_funding_txid: Option<Txid>, secp_ctx: &Secp256k1<All>, ) -> ChannelPublicKeys

Returns a new set of holder channel public keys and basepoints. They may be the same as a previous value, but are also allowed to change arbitrarily. Signing methods must still support signing for any keys which have ever been returned. This should only be called either for new channels or new splices. Read more
Source§

fn channel_keys_id(&self) -> [u8; 32]

Returns an arbitrary identifier describing the set of keys which are provided back to you in some SpendableOutputDescriptor types. This should be sufficient to identify this EcdsaChannelSigner object uniquely and lookup or re-derive its keys. Read more
Source§

impl Clone for InMemorySigner

Source§

fn clone(&self) -> Self

Returns a duplicate 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 EcdsaChannelSigner for InMemorySigner

Source§

fn sign_counterparty_commitment( &self, channel_parameters: &ChannelTransactionParameters, commitment_tx: &CommitmentTransaction, _inbound_htlc_preimages: Vec<PaymentPreimage>, _outbound_htlc_preimages: Vec<PaymentPreimage>, secp_ctx: &Secp256k1<All>, ) -> Result<(Signature, Vec<Signature>), ()>

Create a signature for a counterparty’s commitment transaction and associated HTLC transactions. Read more
Source§

fn sign_holder_commitment( &self, channel_parameters: &ChannelTransactionParameters, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Creates a signature for a holder’s commitment transaction. Read more
Source§

fn sign_justice_revoked_output( &self, channel_parameters: &ChannelTransactionParameters, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Create a signature for the given input in a transaction spending an HTLC transaction output or a commitment transaction to_local output when our counterparty broadcasts an old state. Read more
Source§

fn sign_justice_revoked_htlc( &self, channel_parameters: &ChannelTransactionParameters, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Create a signature for the given input in a transaction spending a commitment transaction HTLC output when our counterparty broadcasts an old state. Read more
Source§

fn sign_holder_htlc_transaction( &self, htlc_tx: &Transaction, input: usize, htlc_descriptor: &HTLCDescriptor, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Computes the signature for a commitment transaction’s HTLC output used as an input within htlc_tx, which spends the commitment transaction at index input. The signature returned must be be computed using EcdsaSighashType::All. Read more
Source§

fn sign_counterparty_htlc_transaction( &self, channel_parameters: &ChannelTransactionParameters, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Create a signature for a claiming transaction for a HTLC output on a counterparty’s commitment transaction, either offered or received. Read more
Source§

fn sign_closing_transaction( &self, channel_parameters: &ChannelTransactionParameters, closing_tx: &ClosingTransaction, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Create a signature for a (proposed) closing transaction. Read more
Source§

fn sign_holder_keyed_anchor_input( &self, chan_params: &ChannelTransactionParameters, anchor_tx: &Transaction, input: usize, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Computes the signature for a commitment transaction’s keyed anchor output used as an input within anchor_tx, which spends the commitment transaction, at index input. Read more
Source§

fn sign_channel_announcement_with_funding_key( &self, channel_parameters: &ChannelTransactionParameters, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<All>, ) -> Result<Signature, ()>

Signs a channel announcement message with our funding key proving it comes from one of the channel participants. Read more
Source§

fn sign_splice_shared_input( &self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction, input_index: usize, secp_ctx: &Secp256k1<All>, ) -> Signature

Signs the shared input of a splice transaction with our funding key. Read more
Source§

impl EntropySource for InMemorySigner

Source§

fn get_secure_random_bytes(&self) -> [u8; 32]

Gets a unique, cryptographically-secure, random 32-byte value. This method must return a different value each time it is called.
Source§

impl PartialEq for InMemorySigner

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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>,

Source§

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>,

Source§

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.