Skip to content

Commit ff1e3cc

Browse files
author
Antoine Riard
committed
Overhaul LocalCommitmentTx to new nomenclature
1 parent ffa2ae8 commit ff1e3cc

File tree

6 files changed

+113
-113
lines changed

6 files changed

+113
-113
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use util::ser::{Writeable, Writer, Readable};
3333

3434
use chain::transaction::OutPoint;
3535
use ln::chan_utils;
36-
use ln::chan_utils::{HTLCOutputInCommitment, make_funding_redeemscript, ChannelPublicKeys, LocalCommitmentTransaction, PreCalculatedTxCreationKeys};
36+
use ln::chan_utils::{HTLCOutputInCommitment, make_funding_redeemscript, ChannelPublicKeys, HolderCommitmentTransaction, PreCalculatedTxCreationKeys};
3737
use ln::msgs::UnsignedChannelAnnouncement;
3838

3939
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -242,14 +242,14 @@ pub trait ChannelKeys : Send+Clone {
242242
//
243243
// TODO: Document the things someone using this interface should enforce before signing.
244244
// TODO: Add more input vars to enable better checking (preferably removing commitment_tx and
245-
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
245+
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
246246

247247
/// Same as sign_holder_commitment, but exists only for tests to get access to holder commitment
248248
/// transactions which will be broadcasted later, after the channel has moved on to a newer
249249
/// state. Thus, needs its own method as sign_holder_commitment may enforce that we only ever
250250
/// get called once.
251251
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))]
252-
fn unsafe_sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
252+
fn unsafe_sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
253253

254254
/// Create a signature for each HTLC transaction spending a holder's commitment transaction.
255255
///
@@ -264,7 +264,7 @@ pub trait ChannelKeys : Send+Clone {
264264
/// (implying they were considered dust at the time the commitment transaction was negotiated),
265265
/// a corresponding None should be included in the return value. All other positions in the
266266
/// return value must contain a signature.
267-
fn sign_holder_commitment_htlc_transactions<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Vec<Option<Signature>>, ()>;
267+
fn sign_holder_commitment_htlc_transactions<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Vec<Option<Signature>>, ()>;
268268

269269
/// Create a signature for the given input in a transaction spending an HTLC or commitment
270270
/// transaction output when our counterparty broadcasts an old state.
@@ -499,24 +499,24 @@ impl ChannelKeys for InMemoryChannelKeys {
499499
Ok((commitment_sig, htlc_sigs))
500500
}
501501

502-
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
502+
fn sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
503503
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
504504
let counterparty_channel_data = self.accepted_channel_data.as_ref().expect("must accept before signing");
505505
let channel_funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &counterparty_channel_data.counterparty_channel_pubkeys.funding_pubkey);
506506

507-
Ok(holder_commitment_tx.get_local_sig(&self.funding_key, &channel_funding_redeemscript, self.channel_value_satoshis, secp_ctx))
507+
Ok(holder_commitment_tx.get_holder_sig(&self.funding_key, &channel_funding_redeemscript, self.channel_value_satoshis, secp_ctx))
508508
}
509509

510510
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))]
511-
fn unsafe_sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
511+
fn unsafe_sign_holder_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
512512
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
513513
let counterparty_channel_pubkeys = &self.accepted_channel_data.as_ref().expect("must accept before signing").counterparty_channel_pubkeys;
514514
let channel_funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &counterparty_channel_pubkeys.funding_pubkey);
515515

516-
Ok(holder_commitment_tx.get_local_sig(&self.funding_key, &channel_funding_redeemscript, self.channel_value_satoshis, secp_ctx))
516+
Ok(holder_commitment_tx.get_holder_sig(&self.funding_key, &channel_funding_redeemscript, self.channel_value_satoshis, secp_ctx))
517517
}
518518

519-
fn sign_holder_commitment_htlc_transactions<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Vec<Option<Signature>>, ()> {
519+
fn sign_holder_commitment_htlc_transactions<T: secp256k1::Signing + secp256k1::Verification>(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<Vec<Option<Signature>>, ()> {
520520
let counterparty_selected_contest_delay = self.accepted_channel_data.as_ref().unwrap().counterparty_selected_contest_delay;
521521
holder_commitment_tx.get_htlc_sigs(&self.htlc_base_key, counterparty_selected_contest_delay, secp_ctx)
522522
}

0 commit comments

Comments
 (0)