Struct lightning::chain::keysinterface::InMemorySigner
source · [−]pub struct InMemorySigner {
pub funding_key: SecretKey,
pub revocation_base_key: SecretKey,
pub payment_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 Sign 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
funding_key: SecretKey
Private key of anchor tx
revocation_base_key: SecretKey
Holder secret key for blinded revocation pubkey
payment_key: SecretKey
Holder secret key used for our balance in counterparty-broadcasted commitment transactions
delayed_payment_base_key: SecretKey
Holder secret key used in HTLC tx
htlc_base_key: SecretKey
Holder htlc secret key used in commitment tx htlc outputs
commitment_seed: [u8; 32]
Commitment seed
Implementations
sourceimpl InMemorySigner
impl InMemorySigner
sourcepub fn new<C: Signing>(
secp_ctx: &Secp256k1<C>,
node_secret: SecretKey,
funding_key: SecretKey,
revocation_base_key: SecretKey,
payment_key: SecretKey,
delayed_payment_base_key: SecretKey,
htlc_base_key: SecretKey,
commitment_seed: [u8; 32],
channel_value_satoshis: u64,
channel_keys_id: [u8; 32]
) -> InMemorySigner
pub fn new<C: Signing>(
secp_ctx: &Secp256k1<C>,
node_secret: SecretKey,
funding_key: SecretKey,
revocation_base_key: SecretKey,
payment_key: SecretKey,
delayed_payment_base_key: SecretKey,
htlc_base_key: SecretKey,
commitment_seed: [u8; 32],
channel_value_satoshis: u64,
channel_keys_id: [u8; 32]
) -> InMemorySigner
Create a new InMemorySigner
sourcepub fn counterparty_pubkeys(&self) -> &ChannelPublicKeys
pub fn counterparty_pubkeys(&self) -> &ChannelPublicKeys
Counterparty pubkeys. Will panic if ready_channel wasn’t called.
sourcepub fn counterparty_selected_contest_delay(&self) -> u16
pub fn counterparty_selected_contest_delay(&self) -> u16
The contest_delay value specified by our counterparty and applied on holder-broadcastable transactions, ie the amount of time that we have to wait to recover our funds if we broadcast a transaction. Will panic if ready_channel wasn’t called.
sourcepub fn holder_selected_contest_delay(&self) -> u16
pub fn holder_selected_contest_delay(&self) -> u16
The contest_delay value specified by us and applied on transactions broadcastable by our counterparty, ie the amount of time that they have to wait to recover their funds if they broadcast a transaction. Will panic if ready_channel wasn’t called.
sourcepub fn is_outbound(&self) -> bool
pub fn is_outbound(&self) -> bool
Whether the holder is the initiator Will panic if ready_channel wasn’t called.
sourcepub fn funding_outpoint(&self) -> &OutPoint
pub fn funding_outpoint(&self) -> &OutPoint
Funding outpoint Will panic if ready_channel wasn’t called.
sourcepub fn get_channel_parameters(&self) -> &ChannelTransactionParameters
pub fn get_channel_parameters(&self) -> &ChannelTransactionParameters
Obtain a ChannelTransactionParameters for this channel, to be used when verifying or building transactions.
Will panic if ready_channel wasn’t called.
sourcepub fn opt_anchors(&self) -> bool
pub fn opt_anchors(&self) -> bool
Whether anchors should be used. Will panic if ready_channel wasn’t called.
sourcepub fn sign_counterparty_payment_input<C: Signing>(
&self,
spend_tx: &Transaction,
input_idx: usize,
descriptor: &StaticPaymentOutputDescriptor,
secp_ctx: &Secp256k1<C>
) -> Result<Vec<Vec<u8>>, ()>
pub fn sign_counterparty_payment_input<C: Signing>(
&self,
spend_tx: &Transaction,
input_idx: usize,
descriptor: &StaticPaymentOutputDescriptor,
secp_ctx: &Secp256k1<C>
) -> Result<Vec<Vec<u8>>, ()>
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 Err 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.
sourcepub fn sign_dynamic_p2wsh_input<C: Signing>(
&self,
spend_tx: &Transaction,
input_idx: usize,
descriptor: &DelayedPaymentOutputDescriptor,
secp_ctx: &Secp256k1<C>
) -> Result<Vec<Vec<u8>>, ()>
pub fn sign_dynamic_p2wsh_input<C: Signing>(
&self,
spend_tx: &Transaction,
input_idx: usize,
descriptor: &DelayedPaymentOutputDescriptor,
secp_ctx: &Secp256k1<C>
) -> Result<Vec<Vec<u8>>, ()>
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 Err 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
sourceimpl BaseSign for InMemorySigner
impl BaseSign for InMemorySigner
sourcefn get_per_commitment_point(
&self,
idx: u64,
secp_ctx: &Secp256k1<All>
) -> PublicKey
fn get_per_commitment_point(
&self,
idx: u64,
secp_ctx: &Secp256k1<All>
) -> PublicKey
Gets the per-commitment point for a specific commitment number Read more
sourcefn release_commitment_secret(&self, idx: u64) -> [u8; 32]
fn release_commitment_secret(&self, idx: u64) -> [u8; 32]
Gets the commitment secret for a specific commitment number as part of the revocation process Read more
sourcefn validate_holder_commitment(
&self,
_holder_tx: &HolderCommitmentTransaction,
_preimages: Vec<PaymentPreimage>
) -> Result<(), ()>
fn validate_holder_commitment(
&self,
_holder_tx: &HolderCommitmentTransaction,
_preimages: Vec<PaymentPreimage>
) -> Result<(), ()>
Validate the counterparty’s signatures on the holder commitment transaction and HTLCs. Read more
sourcefn pubkeys(&self) -> &ChannelPublicKeys
fn pubkeys(&self) -> &ChannelPublicKeys
Gets the holder’s channel public keys and basepoints
sourcefn channel_keys_id(&self) -> [u8; 32]
fn channel_keys_id(&self) -> [u8; 32]
Gets 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 Sign object uniquely and lookup or re-derive its keys. Read more
sourcefn sign_counterparty_commitment(
&self,
commitment_tx: &CommitmentTransaction,
_preimages: Vec<PaymentPreimage>,
secp_ctx: &Secp256k1<All>
) -> Result<(Signature, Vec<Signature>), ()>
fn sign_counterparty_commitment(
&self,
commitment_tx: &CommitmentTransaction,
_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
sourcefn validate_counterparty_revocation(
&self,
_idx: u64,
_secret: &SecretKey
) -> Result<(), ()>
fn validate_counterparty_revocation(
&self,
_idx: u64,
_secret: &SecretKey
) -> Result<(), ()>
Validate the counterparty’s revocation. Read more
sourcefn sign_holder_commitment_and_htlcs(
&self,
commitment_tx: &HolderCommitmentTransaction,
secp_ctx: &Secp256k1<All>
) -> Result<(Signature, Vec<Signature>), ()>
fn sign_holder_commitment_and_htlcs(
&self,
commitment_tx: &HolderCommitmentTransaction,
secp_ctx: &Secp256k1<All>
) -> Result<(Signature, Vec<Signature>), ()>
Create a signatures for a holder’s commitment transaction and its claiming HTLC transactions. This will only ever be called with a non-revoked commitment_tx. This will be called with the latest commitment_tx when we initiate a force-close. This will be called with the previous latest, just to get claiming HTLC signatures, if we are reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to the latest. This may be called multiple times for the same transaction. Read more
sourcefn sign_justice_revoked_output(
&self,
justice_tx: &Transaction,
input: usize,
amount: u64,
per_commitment_key: &SecretKey,
secp_ctx: &Secp256k1<All>
) -> Result<Signature, ()>
fn sign_justice_revoked_output(
&self,
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
sourcefn sign_justice_revoked_htlc(
&self,
justice_tx: &Transaction,
input: usize,
amount: u64,
per_commitment_key: &SecretKey,
htlc: &HTLCOutputInCommitment,
secp_ctx: &Secp256k1<All>
) -> Result<Signature, ()>
fn sign_justice_revoked_htlc(
&self,
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
sourcefn sign_counterparty_htlc_transaction(
&self,
htlc_tx: &Transaction,
input: usize,
amount: u64,
per_commitment_point: &PublicKey,
htlc: &HTLCOutputInCommitment,
secp_ctx: &Secp256k1<All>
) -> Result<Signature, ()>
fn sign_counterparty_htlc_transaction(
&self,
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
sourcefn sign_closing_transaction(
&self,
closing_tx: &ClosingTransaction,
secp_ctx: &Secp256k1<All>
) -> Result<Signature, ()>
fn sign_closing_transaction(
&self,
closing_tx: &ClosingTransaction,
secp_ctx: &Secp256k1<All>
) -> Result<Signature, ()>
Create a signature for a (proposed) closing transaction. Read more
sourcefn sign_channel_announcement(
&self,
msg: &UnsignedChannelAnnouncement,
secp_ctx: &Secp256k1<All>
) -> Result<(Signature, Signature), ()>
fn sign_channel_announcement(
&self,
msg: &UnsignedChannelAnnouncement,
secp_ctx: &Secp256k1<All>
) -> Result<(Signature, Signature), ()>
Signs a channel announcement message with our funding key and our node secret key (aka node_id or network_key), proving it comes from one of the channel participants. Read more
sourcefn ready_channel(&mut self, channel_parameters: &ChannelTransactionParameters)
fn ready_channel(&mut self, channel_parameters: &ChannelTransactionParameters)
Set the counterparty static channel data, including basepoints, counterparty_selected/holder_selected_contest_delay and funding outpoint. This is done as soon as the funding outpoint is known. Since these are static channel data, they MUST NOT be allowed to change to different values once set. Read more
sourceimpl Clone for InMemorySigner
impl Clone for InMemorySigner
sourcefn clone(&self) -> InMemorySigner
fn clone(&self) -> InMemorySigner
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl ReadableArgs<SecretKey> for InMemorySigner
impl ReadableArgs<SecretKey> for InMemorySigner
sourceimpl Writeable for InMemorySigner
impl Writeable for InMemorySigner
sourcefn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
Writes self out to the given Writer
sourcefn encode(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn encode(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Writes self out to a Vec
sourcefn serialized_length(&self) -> usize
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. Read more
impl Sign for InMemorySigner
Auto Trait Implementations
impl RefUnwindSafe for InMemorySigner
impl Send for InMemorySigner
impl Sync for InMemorySigner
impl Unpin for InMemorySigner
impl UnwindSafe for InMemorySigner
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more