pub struct CommitmentTransaction { /* private fields */ }Expand description
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.
This class can be used inside a signer implementation to generate a signature given the relevant secret key.
Implementations§
Source§impl CommitmentTransaction
impl CommitmentTransaction
Sourcepub fn new(
commitment_number: u64,
per_commitment_point: &PublicKey,
to_broadcaster_value_sat: u64,
to_countersignatory_value_sat: u64,
feerate_per_kw: u32,
nondust_htlcs: Vec<HTLCOutputInCommitment>,
channel_parameters: &DirectedChannelTransactionParameters<'_>,
secp_ctx: &Secp256k1<All>,
) -> CommitmentTransaction
pub fn new( commitment_number: u64, per_commitment_point: &PublicKey, to_broadcaster_value_sat: u64, to_countersignatory_value_sat: u64, feerate_per_kw: u32, nondust_htlcs: Vec<HTLCOutputInCommitment>, channel_parameters: &DirectedChannelTransactionParameters<'_>, secp_ctx: &Secp256k1<All>, ) -> CommitmentTransaction
Constructs a new CommitmentTransaction from the list of HTLCs and the direct balances.
All HTLCs MUST be above the dust limit for the channel. The broadcaster and countersignatory amounts MUST be either 0 or above dust. If the amount is 0, the corresponding output will be omitted from the transaction.
Sourcepub fn with_non_zero_fee_anchors(self) -> Self
pub fn with_non_zero_fee_anchors(self) -> Self
Use non-zero fee anchors
This is not exported to bindings users due to move, and also not likely to be useful for binding users
Sourcepub fn commitment_number(&self) -> u64
pub fn commitment_number(&self) -> u64
The backwards-counting commitment number
Sourcepub fn per_commitment_point(&self) -> PublicKey
pub fn per_commitment_point(&self) -> PublicKey
The per commitment point used by the broadcaster.
Sourcepub fn to_broadcaster_value_sat(&self) -> u64
pub fn to_broadcaster_value_sat(&self) -> u64
The value to be sent to the broadcaster
Sourcepub fn to_countersignatory_value_sat(&self) -> u64
pub fn to_countersignatory_value_sat(&self) -> u64
The value to be sent to the counterparty
Sourcepub fn negotiated_feerate_per_kw(&self) -> u32
pub fn negotiated_feerate_per_kw(&self) -> u32
The feerate paid per 1000-weight-unit we negotiated with our peer for this commitment transaction. Note that the actual feerate of the commitment transaction may be higher than the negotiated feerate.
Sourcepub fn nondust_htlcs(&self) -> &Vec<HTLCOutputInCommitment>
pub fn nondust_htlcs(&self) -> &Vec<HTLCOutputInCommitment>
The non-dust HTLCs (direction, amt, height expiration, hash, transaction output index) which were included in this commitment transaction in output order. The transaction index is always populated.
This is not exported to bindings users as we cannot currently convert Vec references to/from C, though we should expose a less effecient version which creates a Vec of references in the future.
Sourcepub fn trust(&self) -> TrustedCommitmentTransaction<'_>
pub fn trust(&self) -> TrustedCommitmentTransaction<'_>
Trust our pre-built transaction and derived transaction creation public keys.
Applies a wrapper which allows access to these fields.
This should only be used if you fully trust the builder of this object. It should not be used by an external signer - instead use the verify function.
Sourcepub fn verify<T: Signing + Verification>(
&self,
channel_parameters: &DirectedChannelTransactionParameters<'_>,
secp_ctx: &Secp256k1<T>,
) -> Result<TrustedCommitmentTransaction<'_>, ()>
pub fn verify<T: Signing + Verification>( &self, channel_parameters: &DirectedChannelTransactionParameters<'_>, secp_ctx: &Secp256k1<T>, ) -> Result<TrustedCommitmentTransaction<'_>, ()>
Verify our pre-built transaction and derived transaction creation public keys.
Applies a wrapper which allows access to these fields.
An external validating signer must call this method before signing or using the built transaction.
Trait Implementations§
Source§impl Clone for CommitmentTransaction
impl Clone for CommitmentTransaction
Source§fn clone(&self) -> CommitmentTransaction
fn clone(&self) -> CommitmentTransaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommitmentTransaction
impl Debug for CommitmentTransaction
Source§impl PartialEq for CommitmentTransaction
impl PartialEq for CommitmentTransaction
Source§impl Readable for CommitmentTransaction
impl Readable for CommitmentTransaction
Source§impl Writeable for CommitmentTransaction
impl Writeable for CommitmentTransaction
impl Eq for CommitmentTransaction
Auto Trait Implementations§
impl Freeze for CommitmentTransaction
impl RefUnwindSafe for CommitmentTransaction
impl Send for CommitmentTransaction
impl Sync for CommitmentTransaction
impl Unpin for CommitmentTransaction
impl UnwindSafe for CommitmentTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LengthReadable for Twhere
T: Readable,
impl<T> LengthReadable for Twhere
T: Readable,
Source§fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
Self in from the given LengthLimitedRead.